Problem:
I am working on a flutter web application. I am able to contact my Backendless database and create tables with data without any problem, , but when I try to do a simple query, the application throws a reflectable error.
Question:
I imported the Reflectable library, but I don’t know what I need to do, or why this error is happening on query but not on create. Any help would be greatly appreciated. Dealing with reflectable is a real blocker for me. Is there a way that I can avoid needing to do this just to query or update a table?
Code:
await Backendless.initApp(
applicationId: 'xxxxx',
jsApiKey: 'xxxxx');
DataQueryBuilder queryBuilder = DataQueryBuilder()
..whereClause = "title LIKE '$keyword%'";
await Backendless.data
.withClass<CustomClass>()
.find(queryBuilder)
.then((results) =>results);
Errror:
Error: Unhandled error Bad state: Reflectable has not been initialized.
Please make sure that the first action taken by your program
in main
is to call initializeReflectable()
. occurred in Instance of ‘SearchBloc’.
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 236:49 throw
packages/reflectable/src/reflectable_builder_based.dart 180:5 get data
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 825:8 get
packages/reflectable/src/reflectable_builder_based.dart 2569:31 reflectType
packages/backendless_sdk/src/modules/data/reflector.dart 146:48 getServerName
packages/backendless_sdk/src/modules/data/data_store.dart 205:28 new
packages/backendless_sdk/src/modules/data/data.dart 35:39 withClass
packages/just_unsubbed/data/repositories/database_repository.dart 21:10 searchCreatorChannelByKeyword
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1613:54 runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 155:18 handleValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 707:44 handleValueCallback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 736:13 _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 542:5 [_completeWithValue]
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 580:7 callback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15
at Object.throw_ [as throw] (http://localhost:59376/dart_sdk.js:5041:11)
at http://localhost:59376/packages/bloc/src/bloc_observer.dart.lib.js:157:21
at search_bloc.SearchBloc.new.onError (http://localhost:59376/packages/bloc/src/bloc_observer.dart.lib.js:158:28)
at _RootZone.runBinaryGuarded (http://localhost:59376/dart_sdk.js:37227:11)
at sendError (http://localhost:59376/dart_sdk.js:31159:26)
at _BroadcastSubscription.new.[_sendError] (http://localhost:59376/dart_sdk.js:31176:11)
at _BroadcastSubscription.new.[_addError] (http://localhost:59376/dart_sdk.js:31102:27)
at http://localhost:59376/dart_sdk.js:31802:34
at _SyncBroadcastStreamController.new.[_forEachListener] (http://localhost:59376/dart_sdk.js:31652:13)
at _SyncBroadcastStreamController.new.[_sendError] (http://localhost:59376/dart_sdk.js:31801:31)
at _SyncBroadcastStreamController.new.[_addError] (http://localhost:59376/dart_sdk.js:31630:25)
at _RootZone.runBinaryGuarded (http://localhost:59376/dart_sdk.js:37227:11)
at sendError (http://localhost:59376/dart_sdk.js:31159:26)
at _ForwardingStreamSubscription.new.[_sendError] (http://localhost:59376/dart_sdk.js:31176:11)
at _ForwardingStreamSubscription.new.[_addError] (http://localhost:59376/dart_sdk.js:31102:27)
at _ForwardingStreamSubscription.new.[_addError] (http://localhost:59376/dart_sdk.js:35161:25)
at _MapStream.new.[_handleError] (http://localhost:59376/dart_sdk.js:35119:24)
at _ForwardingStreamSubscription.new.[_handleError] (http://localhost:59376/dart_sdk.js:35186:38)
at _RootZone.runBinaryGuarded (http://localhost:59376/dart_sdk.js:37227:11)
at sendError (http://localhost:59376/dart_sdk.js:31159:26)
at _ControllerSubscription.new.[_sendError] (http://localhost:59376/dart_sdk.js:31176:11)
at async._DelayedError.new.perform (http://localhost:59376/dart_sdk.js:34444:27)
at _StreamImplEvents.new.handleNext (http://localhost:59376/dart_sdk.js:34521:15)
at async._AsyncCallbackEntry.new.callback (http://localhost:59376/dart_sdk.js:34282:16)
at Object._microtaskLoop (http://localhost:59376/dart_sdk.js:37526:13)
at _startMicrotaskLoop (http://localhost:59376/dart_sdk.js:37532:13)
at http://localhost:59376/dart_sdk.js:33303:9