proto cleanup

This commit is contained in:
Christien Rioux 2023-09-26 18:46:02 -04:00
parent f951acd79a
commit a93c711d52
84 changed files with 2393 additions and 2087 deletions

View file

@ -1,28 +0,0 @@
import 'dart:convert';
import 'dart:typed_data';
T jsonDecodeBytes<T>(T Function(dynamic) fromJson, Uint8List data) =>
fromJson(jsonDecode(utf8.decode(data)));
T? jsonDecodeOptBytes<T>(T Function(dynamic) fromJson, Uint8List? data) =>
(data == null) ? null : fromJson(jsonDecode(utf8.decode(data)));
Uint8List jsonEncodeBytes(Object? object,
{Object? Function(Object?)? toEncodable}) =>
Uint8List.fromList(
utf8.encode(jsonEncode(object, toEncodable: toEncodable)));
Future<Uint8List> jsonUpdateBytes<T>(T Function(dynamic) fromJson,
Uint8List oldBytes, Future<T> Function(T) update) async {
final oldObj = fromJson(jsonDecode(utf8.decode(oldBytes)));
final newObj = await update(oldObj);
return jsonEncodeBytes(newObj);
}
Future<Uint8List> Function(Uint8List) jsonUpdate<T>(
T Function(dynamic) fromJson, Future<T> Function(T) update) =>
(oldBytes) => jsonUpdateBytes(fromJson, oldBytes, update);
T Function(Object?) genericFromJson<T>(
T Function(Map<String, dynamic>) fromJsonMap) =>
(json) => fromJsonMap(json! as Map<String, dynamic>);

View file

@ -1,17 +0,0 @@
import 'dart:typed_data';
import 'package:protobuf/protobuf.dart';
Future<Uint8List> protobufUpdateBytes<T extends GeneratedMessage>(
T Function(List<int>) fromBuffer,
Uint8List oldBytes,
Future<T> Function(T) update) async {
final oldObj = fromBuffer(oldBytes);
final newObj = await update(oldObj);
return Uint8List.fromList(newObj.writeToBuffer());
}
Future<Uint8List> Function(Uint8List)
protobufUpdate<T extends GeneratedMessage>(
T Function(List<int>) fromBuffer, Future<T> Function(T) update) =>
(oldBytes) => protobufUpdateBytes(fromBuffer, oldBytes, update);

View file

@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_chat_ui/flutter_chat_ui.dart';
import 'package:radix_colors/radix_colors.dart';
@ -527,7 +526,7 @@ ChatTheme makeChatTheme(ScaleScheme scale, TextTheme textTheme) =>
inputContainerDecoration: BoxDecoration(color: scale.primaryScale.border),
inputPadding: const EdgeInsets.all(9),
inputTextColor: scale.primaryScale.text,
attachmentButtonIcon: Icon(Icons.attach_file),
attachmentButtonIcon: const Icon(Icons.attach_file),
);
ThemeData radixGenerator(Brightness brightness, RadixThemeColor themeColor) {

View file

@ -1,5 +1,6 @@
import 'dart:typed_data';
import '../entities/local_account.dart';
import '../veilid_init.dart';
import '../veilid_support/veilid_support.dart';
Future<Uint8List> encryptSecretToBytes(

View file

@ -20,4 +20,5 @@ final themeServiceProvider = AutoDisposeFutureProvider<ThemeService>.internal(
);
typedef ThemeServiceRef = AutoDisposeFutureProviderRef<ThemeService>;
// ignore_for_file: unnecessary_raw_strings, subtype_of_sealed_class, invalid_use_of_internal_member, do_not_use_environment, prefer_const_constructors, public_member_api_docs, avoid_private_typedef_functions
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member

View file

@ -1,8 +1,6 @@
export 'animations.dart';
export 'external_stream_state.dart';
export 'json_tools.dart';
export 'phono_byte.dart';
export 'protobuf_tools.dart';
export 'radix_generator.dart';
export 'responsive.dart';
export 'secret_crypto.dart';