Open saharvx9 opened 3 years ago
Hi @saharvx9 Can you please provide lib/repository/rest/api.dart source code, to reproduce the problem or understand what might have gone wrong.
Hi rest api is an interface it doesn't relate to floor it look like this:
class RestApi {
login(String username, String password) {}
getMachines(String? updateDt) {}
getAlerts(String? updateDt) {}
getMachinesExtraData(String? updateDt, List<int>? machines) {}
getActorsHierarchy() {}
getGroups(String? updateDt) {}
getMachineInfo(int machineId_) {}
}
if i a'm deleting this class it present to me another class with this error with new class name if i'a, puttng a comment for whole classses it still present this error. I think there is a cache issue with all generator classes.
hmm, in my assumption the floor annotations are used unproperly somewhere in the code. Can you please double-check the structure of the floor annotation declaration in your project, please? Maybe it's a wrong import in the class. It's hard to answer now. Here is the how-to manual https://vitusortner.github.io/floor/getting-started/
I took all the floor classes to new project and it finish sucssefully. But when i'm returning other packges its happend again...
Can you run dartanalyzer/flutter analyze on your code? What is the output?
I'm having the same exception when I'm trying to build my .db.
final database = await $FloorAppDatabase.databaseBuilder(floorDB).build();
inside sqlite_database_factory.dart
databasesPath is null.
extension DatabaseFactoryExtension on DatabaseFactory {
Future<String> getDatabasePath(final String name) async {
final databasesPath = await this.getDatabasesPath();
return join(databasesPath, name);
}
}
E/flutter (17966): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Null check operator used on a null value
E/flutter (17966): #0 MethodChannel.binaryMessenger (package:flutter/src/services/platform_channel.dart:142:86)
E/flutter (17966): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:148:36)
E/flutter (17966): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:331:12)
E/flutter (17966): #3 invokeMethod (package:sqflite/src/sqflite_impl.dart:17:13)
E/flutter (17966): #4 SqfliteDatabaseFactoryImpl.invokeMethod (package:sqflite/src/factory_impl.dart:82:7)
E/flutter (17966): #5 SqfliteDatabaseFactoryMixin.safeInvokeMethod.<anonymous closure> (package:sqflite_common/src/factory_mixin.dart:41:38)
E/flutter (17966): #6 wrapDatabaseException (package:sqflite/src/exception_impl.dart:7:32)
E/flutter (17966): #7 SqfliteDatabaseFactoryImpl.wrapDatabaseException (package:sqflite/src/factory_impl.dart:78:7)
E/flutter (17966): #8 SqfliteDatabaseFactoryMixin.safeInvokeMethod (package:sqflite_common/src/factory_mixin.dart:41:7)
E/flutter (17966): #9 SqfliteDatabaseFactoryMixin.getDatabasesPath (package:sqflite_common/src/factory_mixin.dart:153:26)
E/flutter (17966): #10 DatabaseFactoryExtension.getDatabasePath (package:floor/src/sqflite_database_factory.dart:24:38)
E/flutter (17966): #11 _$AppDatabaseBuilder.build (package:lullabies_flutter/app/data/repositories/floor_database.g.dart:46:40)
E/flutter (17966): #12 main (package:lullabies_flutter/main.dart:13:69)
E/flutter (17966): #13 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:146:25)
E/flutter (17966): #14 _rootRun (dart:async/zone.dart:1354:13)
E/flutter (17966): #15 _CustomZone.run (dart:async/zone.dart:1258:19)
E/flutter (17966): #16 _runZoned (dart:async/zone.dart:1789:10)
E/flutter (17966): #17 runZonedGuarded (dart:async/zone.dart:1777:12)
E/flutter (17966): #18 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:139:5)
E/flutter (17966): #19 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:283:19)
E/flutter (17966): #20 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
@roma7481 I'm not sure if your described issue is related to the one reported initially. Which version of floor are you using?
@saharvx9 are you still experiencing the problem with the newest version?
I got the same problem.
E/flutter (17113): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Null check operator used on a null value E/flutter (17113): #0 MethodChannel.binaryMessenger (package:flutter/src/services/platform_channel.dart:142:86) E/flutter (17113): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:148:36) E/flutter (17113): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:331:12) E/flutter (17113): #3 invokeMethod (package:sqflite/src/sqflite_impl.dart:17:13) E/flutter (17113): #4 SqfliteDatabaseFactoryImpl.invokeMethod (package:sqflite/src/factory_impl.dart:82:7) E/flutter (17113): #5 SqfliteDatabaseFactoryMixin.safeInvokeMethod.<anonymous closure> (package:sqflite_common/src/factory_mixin.dart:41:38) E/flutter (17113): #6 wrapDatabaseException (package:sqflite/src/exception_impl.dart:7:32) E/flutter (17113): #7 SqfliteDatabaseFactoryImpl.wrapDatabaseException (package:sqflite/src/factory_impl.dart:78:7) E/flutter (17113): #8 SqfliteDatabaseFactoryMixin.safeInvokeMethod (package:sqflite_common/src/factory_mixin.dart:41:7) E/flutter (17113): #9 SqfliteDatabaseFactoryMixin.getDatabasesPath (package:sqflite_common/src/factory_mixin.dart:153:26) E/flutter (17113): #10 DatabaseFactoryExtension.getDatabasePath (package:floor/src/sqflite_database_factory.dart:24:38) E/flutter (17113): #11 _$AppDatabaseBuilder.build (package:movecat_smart_app/database/app_database.g.dart:46:40) E/flutter (17113): #12 LocalRepository._initDb (package:movecat_smart_app/repositories/local_repository.dart:152:10) E/flutter (17113): #13 new LocalRepository (package:movecat_smart_app/repositories/local_repository.dart:8:5) E/flutter (17113): #14 main (package:movecat_smart_app/main.dart:47:24) E/flutter (17113): #15 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:142:25) E/flutter (17113): #16 _rootRun (dart:async/zone.dart:1354:13) E/flutter (17113): #17 _CustomZone.run (dart:async/zone.dart:1258:19) E/flutter (17113): #18 _runZoned (dart:async/zone.dart:1789:10) E/flutter (17113): #19 runZonedGuarded (dart:async/zone.dart:1777:12) E/flutter (17113): #20 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:138:5) E/flutter (17113): #21 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:283:19) E/flutter (17113): #22 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
I run on the newest version from floor and floor-generator. Floor Version: 1.1.0
Any update?
This error happened to me when I wanted to obtain an instance of the database before the runApp method, the solution for me was to execute this method before instantiating it:
WidgetsFlutterBinding.ensureInitialized();
Personally I recommend using FutureBuilder and waiting for the Database to be instantiated, in this way the UI would not wait to be displayed by the database
I get this error too. Null check operator used on a null value package:source_gen/src/type_checker.dart 177:74 TypeChecker.isExactlyType package:floor_generator/misc/type_utils.dart 32:43 StreamTypeChecker.isStream package:floor_generator/processor/query_method_processor.dart 43:41 QueryMethodProcessor.process
My wrong code :
@Query("DELETE FROM inn_info WHERE inn=:innInfo.inn") void delete(InnInfo innInfo);
Real error: All queries have to return a Future or Stream.
Hi while i am generating new table or queries i'm getting this error:
Here is my flutter doctor: