diff --git a/.gitignore b/.gitignore index 92997d6..a81f05c 100644 --- a/.gitignore +++ b/.gitignore @@ -97,4 +97,7 @@ coverage/ !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages \ No newline at end of file +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +# FVM Version Cache +.fvm/ \ No newline at end of file diff --git a/lib/app_state.dart b/lib/app_state.dart index 01ddcc2..4a16958 100644 --- a/lib/app_state.dart +++ b/lib/app_state.dart @@ -9,15 +9,15 @@ class AppState extends ChangeNotifier { notifyListeners(); } - String _boxName; - String get boxName => _boxName; + String? _boxName; + String get boxName => _boxName ?? ''; set boxName(String boxName) { _boxName = boxName; notifyListeners(); } - Map _entries; - Map get entries => _entries; + Map? _entries; + Map get entries => _entries ?? {}; set entries(Map entries) { _entries = entries; notifyListeners(); diff --git a/lib/data_explorer.dart b/lib/data_explorer.dart index 2962614..dd1a97c 100644 --- a/lib/data_explorer.dart +++ b/lib/data_explorer.dart @@ -90,7 +90,7 @@ class EntryWidget extends StatelessWidget { return Card( elevation: 0, shape: RoundedRectangleBorder( - side: BorderSide(width: 1, color: Colors.grey[300]), + side: BorderSide(width: 1, color: Colors.grey[300]!), borderRadius: BorderRadius.all(Radius.circular(10)), ), clipBehavior: Clip.antiAlias, @@ -110,9 +110,11 @@ class EntryWidget extends StatelessWidget { ), ), ), - Text( - value.toString(), - style: TextStyle(fontSize: 16), + Expanded( + child: Text( + value.toString(), + style: TextStyle(fontSize: 16), + ), ), ], ), diff --git a/lib/file_upload.dart b/lib/file_upload.dart index aa6c684..77349a3 100644 --- a/lib/file_upload.dart +++ b/lib/file_upload.dart @@ -14,15 +14,15 @@ class FileUpload extends StatefulWidget { } class _FileUploadState extends State { - StreamSubscription _dragOverSubscription; - StreamSubscription _dropSubscription; + StreamSubscription? _dragOverSubscription; + StreamSubscription? _dropSubscription; @override void initState() { super.initState(); - _dropSubscription = document.body.onDragOver.listen(_onDragOver); - _dropSubscription = document.body.onDrop.listen(_onDrop); + _dropSubscription = document.body?.onDragOver.listen(_onDragOver); + _dropSubscription = document.body?.onDrop.listen(_onDrop); } void _onDragOver(MouseEvent event) { @@ -35,7 +35,7 @@ class _FileUploadState extends State { event.preventDefault(); var files = event.dataTransfer.files; - if (files.isEmpty) return; + if (files == null || files.isEmpty) return; var file = files.first; var reader = FileReader(); @@ -44,12 +44,12 @@ class _FileUploadState extends State { }); reader.readAsArrayBuffer(file); - var appState = Provider.of(context); + var appState = Provider.of(context, listen: false); appState.status = UploadStatus.processing; } void _process(String name, Uint8List bytes) { - var appState = Provider.of(context); + var appState = Provider.of(context, listen: false); scheduleMicrotask(() async { try { var box = await Hive.openBox('box', bytes: bytes); @@ -84,7 +84,6 @@ class _FileUploadState extends State { case UploadStatus.success: return DataExplorer(); } - return Container(); } @override diff --git a/lib/main.dart b/lib/main.dart index e09c559..75f9ad9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,7 +7,7 @@ import 'package:studio/object_adapter.dart'; void main() { for (var i = 0; i < 224; i++) { - Hive.registerAdapter(ObjectAdapter(), i); + Hive.registerAdapter(ObjectAdapter(i)); } runApp(MyApp()); } diff --git a/lib/object_adapter.dart b/lib/object_adapter.dart index a3fae70..7b7ecbd 100644 --- a/lib/object_adapter.dart +++ b/lib/object_adapter.dart @@ -3,6 +3,13 @@ import 'dart:typed_data'; import 'package:hive/hive.dart'; class ObjectAdapter extends TypeAdapter { + final int _typeId; + + ObjectAdapter(this._typeId); + + @override + int get typeId => _typeId; + @override Object read(BinaryReader reader) { var bytes = reader.peekBytes(reader.availableBytes); diff --git a/lib/path_view.dart b/lib/path_view.dart index aa8fe31..ff9c8a7 100644 --- a/lib/path_view.dart +++ b/lib/path_view.dart @@ -6,7 +6,7 @@ class PathView extends StatelessWidget { @override Widget build(BuildContext context) { return Consumer( - builder: (BuildContext context, AppState app, Widget child) { + builder: (BuildContext context, AppState app, Widget? child) { return Row( children: [ _buildPathElement(app.boxName, () { diff --git a/pubspec.yaml b/pubspec.yaml index 1d122d9..96fbd7c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,17 +4,17 @@ description: A new Flutter project. version: 1.0.0+1 environment: - sdk: ">=2.6.0 <3.0.0" + sdk: '>=3.0.3 <4.0.0' dependencies: flutter: sdk: flutter - hive: 1.2.0 + hive: ^2.2.3 provider: any dev_dependencies: - pedantic: 1.9.0 + pedantic: ^1.11.1 flutter: uses-material-design: true