I have a method thats called to load models but seems to crash every time I call it, I followed the documentation for it I believe so I dont understand why.
Future loadModel() async {
await FirebaseModelDownloader.instance
.getModel(
"Breed-Detector",
FirebaseModelDownloadType.latestModel,
FirebaseModelDownloadConditions(
iosAllowsCellularAccess: true,
iosAllowsBackgroundDownloading: false,
androidChargingRequired: false,
androidWifiRequired: false,
androidDeviceIdleRequired: false,
))
.then((customModel) async {
final localModelPath = customModel.file;
Tflite.close();
String res;
res = (await Tflite.loadModel(
model: localModelPath.toString(), labels: "assets/labels.txt"))!;
print("Models Loading status: ${res}");
});
}
I get the error
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(Failed to load model, flutter_assets/File: '/data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Breed-Detector/0', java.io.FileNotFoundException: flutter_assets/File: '/data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Breed-Detector/0'
but I have the model uploaded
tried uploading a separate model and that seemed to try and download it at first but failed again.
/ModelFileDownloadSer( 7365): Need to download a new model.
D/ModelFileDownloadSer( 7365): Schedule a new downloading task: 64
D/ModelFileDownloadSer( 7365): Model downloaded successfully
D/ModelFileDownloadSer( 7365): Moving downloaded model from external storage to destination folder.
D/ModelFileDownloadSer( 7365): Moved the downloaded model to destination folder successfully: /data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Dog-Breeds
E/flutter ( 7365): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(Failed to load model, flutter_assets/File: '/data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Dog-Breeds/0', java.io.FileNotFoundException: flutter_assets/File: '/data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Dog-Breeds/0'
E/flutter ( 7365): at android.content.res.AssetManager.nativeOpenAssetFd(Native Method)
E/flutter ( 7365): at android.content.res.AssetManager.openFd(AssetManager.java:898)
E/flutter ( 7365): at sq.flutter.tflite.TflitePlugin.loadModel(TflitePlugin.java:210)
E/flutter ( 7365): at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:98)
E/flutter ( 7365): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter ( 7365): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/flutter ( 7365): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:319)
E/flutter ( 7365): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/flutter ( 7365): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter ( 7365): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter ( 7365): at android.os.Looper.loop(Looper.java:223)
E/flutter ( 7365): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter ( 7365): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 7365): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter ( 7365): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 7365): , null)
Related
I encountered this error but I got no luck in finding a solution on this. Any idea on how I can resolve or at least try to understand what is the issue? Thanks!
E/flutter (18634): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: The Android view returned from PlatformView#getView() was already added to a parent view.
E/flutter (18634): at io.flutter.plugin.platform.PlatformViewsController$1.createForTextureLayer(PlatformViewsController.java:238)
E/flutter (18634): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:122)
E/flutter (18634): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60)
E/flutter (18634): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (18634): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/flutter (18634): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/flutter (18634): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/flutter (18634): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (18634): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (18634): at android.os.Looper.loopOnce(Looper.java:226)
E/flutter (18634): at android.os.Looper.loop(Looper.java:313)
E/flutter (18634): at android.app.ActivityThread.main(ActivityThread.java:8751)
E/flutter (18634): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (18634): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/flutter (18634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
E/flutter (18634): , null, null)
E/flutter (18634): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
E/flutter (18634): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
E/flutter (18634): <asynchronous suspension>
E/flutter (18634): #2 TextureAndroidViewController._sendCreateMessage (package:flutter/src/services/platform_views.dart:1146:18)
E/flutter (18634): <asynchronous suspension>
E/flutter (18634): #3 AndroidViewController.create (package:flutter/src/services/platform_views.dart:792:5)
E/flutter (18634): <asynchronous suspension>
I tried to check the layout explorer but I haven't see any PlatformView so I'm stuck.
using flutter I try top open my audio from gallery in app as a ListView
I try to get audios from Gallery using photo_mager:-
List<AssetEntity>? media;
fetchAudio() async {
List<AssetPathEntity> albumsAudio =
await PhotoManager.getAssetPathList(type: RequestType.audio);
if (albumsAudio.isEmpty) return;
media = await albumsAudio[0].getAssetListPaged(page: 0, size: 60);
int dur = media![0].duration;
print('imageeeeee $dur');
media!.length;
}
and paly the url of audio using audio_palyer:-
File newFile = await media![index].file;
_audioPlayer.play( newFile!.path);
BUT it give me this error
E/flutter (22117): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(Unexpected error!, /storage/emulated/0/Download/09.Wehyati Khaliki.Starz.mp3: open failed: ENOENT (No such file or directory), java.io.FileNotFoundException: /storage/emulated/0/Download/09.Wehyati Khaliki.Starz.mp3: open failed: ENOENT (No such file or directory)
E/flutter (22117): at libcore.io.IoBridge.open(IoBridge.java:496)
E/flutter (22117): at java.io.FileInputStream.<init>(FileInputStream.java:159)
E/flutter (22117): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1238)
E/flutter (22117): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1216)
E/flutter (22117): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1181)
E/flutter (22117): at xyz.luan.audioplayers.WrappedMediaPlayer.setUrl(WrappedMediaPlayer.kt:37)
E/flutter (22117): at xyz.luan.audioplayers.AudioplayersPlugin.handleMethodCall(AudioplayersPlugin.kt:59)
E/flutter (22117): at xyz.luan.audioplayers.AudioplayersPlugin.onMethodCall(AudioplayersPlugin.kt:33)
E/flutter (22117): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (22117): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/flutter (22117): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
E/flutter (22117): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$AIEPqY6mWzaNK15HekX9bftoAXs.run(Unknown Source:12)
E/flutter (22117): at android.os.Handler.handleCallback(Handler.java:883)
E/flutter (22117): at android.os.Handler.dispatchMessage(Handler.java:100)
E/flutter (22117): at android.os.Looper.loop(Looper.java:224)
E/flutter (22117): at android.app.ActivityThread.main(ActivityThread.java:7561)
E/flutter (22117): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (22117): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
E/flutter (22117): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
E/flutter (22117): Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
E/flutter (22117): at libcore.io.Linux.open(Native Method)
E/flutter (22117): at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
E/flutter (22117): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
E/flutter (22117): at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
E/flutter (22117): at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7458)
E/flutter (22117): at libcore.io.IoBridge.open(IoBridge.java:482)
E/flutter (22117): ... 18 more
E/flutter (22117): , null)
Flutter version
• Flutter version 2.10.4 at C:\flutterSDKs\flutter_2.10.4
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (3 months ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
TFLite (movenet/multipose/lightning/tflite/float16)
I have loaded the model successfully but whenever I tried to run it... it just crashes the
app.
here is the code for loading and running the model:
Future loadModel() async {
try {
res = await Tflite.loadModel(
model:
"assets/lite-model_movenet_multipose_lightning_tflite_float16_1.tflite",
);
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> model loaded: " + res.toString());
} catch (e) {
print(e);
print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Failed to load model.');
} }
Future poseNet(File image) async {
int startTime = new DateTime.now().millisecondsSinceEpoch;
var output = await Tflite.runPoseNetOnImage(
threshold: 0.7,
path: image.path,
numResults: 5,
nmsRadius: 15
);
print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> recognitions: ${output}');
setState(() {
_recognitions = output!;
});
int endTime = new DateTime.now().millisecondsSinceEpoch;
print(
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Inference took ${endTime - startTime}ms ");}
here are the logs:
I/tflite (11904): Initialized TensorFlow Lite runtime.
I/flutter (11904): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> model loaded: success
W/System (11904): A resource failed to call close.
D/EGL_emulation(11904): eglCreateContext: 0xead612c0: maj 2 min 0 rcv 2
E/flutter (11904): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(Failed to run model, length=3; index=3, java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
E/flutter (11904): at sq.flutter.tflite.TflitePlugin.initPoseNet(TflitePlugin.java:1262)
E/flutter (11904): at sq.flutter.tflite.TflitePlugin$RunPoseNet.<init>(TflitePlugin.java:1290)
E/flutter (11904): at sq.flutter.tflite.TflitePlugin.runPoseNetOnImage(TflitePlugin.java:1217)
E/flutter (11904): at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:179)
E/flutter (11904): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (11904): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
E/flutter (11904): at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
E/flutter (11904): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$6ZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown Source:12)
E/flutter (11904): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (11904): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (11904): at android.os.Looper.loop(Looper.java:223)
E/flutter (11904): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter (11904): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (11904): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter (11904): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter (11904): , null)
E/flutter (11904): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (11904): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter (11904): <asynchronous suspension>
E/flutter (11904): #2 Tflite.runPoseNetOnImage (package:tflite/tflite.dart:350:12)
E/flutter (11904): <asynchronous suspension>
E/flutter (11904): #3 _SelectImageState.poseNet (package:model_ui/main/select_image.dart:105:18)
E/flutter (11904): <asynchronous suspension>
E/flutter (11904):
any help will be appreciated!
thank you!
I'm not an expert. But tflite plugin is out of date. You should try your luck with the tflite_flutter, which is also a bit outdated. But worked for me.
Permission to read External Storage is Granted. I am trying to read the path of files in a folder and if the path contains ".mp4" then make an image thumbnail from the video.
_mediaList the list of paths of all the files in the folder.
sample-path is like storage/emulated/0/StatusSaver/Downloads/469a14c6f26e47968b322b9d08ebe2b0.mp4
_mediaList.forEach((element) async {
if (element.path.contains(".mp4")) {
print("Video Status");
await VideoThumbnail.thumbnailData(
video: element.path,
imageFormat: ImageFormat.JPEG,
maxWidth:
128,
quality: 25,
).then((value) {
StatusList.insert(0, {
"type": StatusType.video,
"path": element.path,
"thumbnail": value
});
});
}
Error is like this
I/flutter (18331): PermissionStatus.granted
D/ThumbnailPlugin(18331): buildThumbnailData( format:0, maxh:0, maxw:128, timeMs:0, quality:25 )
W/System.err(18331): java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA
W/System.err(18331): at android.media.MediaMetadataRetriever._setDataSource(Native Method)
W/System.err(18331): at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:103)
W/System.err(18331): at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.createVideoThumbnail(VideoThumbnailPlugin.java:205)
W/System.err(18331): at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.buildThumbnailData(VideoThumbnailPlugin.java:116)
W/System.err(18331): at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.access$100(VideoThumbnailPlugin.java:37)
W/System.err(18331): at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin$1.run(VideoThumbnailPlugin.java:77)
W/System.err(18331): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err(18331): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err(18331): at java.lang.Thread.run(Thread.java:919)
E/flutter (18331): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation found for method data on channel video_thumbnail)
E/flutter (18331): #0 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:156
E/flutter (18331): <asynchronous suspension>
E/flutter (18331): #1 VideoThumbnail.thumbnailData
package:video_thumbnail/video_thumbnail.dart:67
E/flutter (18331): <asynchronous suspension>
E/flutter (18331): #2 FileUtils.readSavedStatusFolder.<anonymous closure>
package:statussaver/model/file_utils.dart:53
E/flutter (18331): <asynchronous suspension>
E/flutter (18331):
So, The issue was with the path going into the thumbnailData.
I just had to add a "/" at the starting of the path.
As without "/", it was able to read the videos.
I have a sqflite database that works, unit tests work. I want to call a sqflite method in onTap method. I understand I cannot execute the sqflite function in the main UI thread (Flutter tells me that at runtime). So I created an Isolate to call the sqflite function, which gives a different error. The Isolate works if I don't call the sqflite function, works if I just return a bool. Here is the code and exception - thanks for any suggestions:
Snippet from UI
Widget loginButton(BuildContext context) {
return Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 20.0, right: 5.0, top: 20.0, bottom: 0.0),
child: GestureDetector(
onTap: () {
if (emailController.text.length > 1 && passwordController.text.length > 7) {
/// Find user. Then...
doCheckIfFoundUser(emailController.text.trim(), passwordController.text);
} else {
printUserNotFound();
}
},
child: buttonContainer(Colors.indigo, "Login", 20.0),
),
),
);
Method called from UI
doCheckIfFoundUser(String email, String password) async {
var result;
List<String> emailPasswordList = new List();
emailPasswordList.add(email);
emailPasswordList.add(password);
var receivePort = new ReceivePort();
Isolate.spawn(callbackFunction, receivePort.sendPort);
SendPort sendPort = await receivePort.first;
var ans = await sendReceive(sendPort, emailPasswordList);
setState(() {
result = ans;
print("The value is $result - please do your thing");
});
}
Isolate Callback
static void callbackFunction(SendPort callerSendPort) async {
ReceivePort newIsolateReceivePort = ReceivePort();
callerSendPort.send(newIsolateReceivePort.sendPort);
var msg = await newIsolateReceivePort.first;
List<String> emailPasswordList = msg[0];
print("email: ${emailPasswordList[0]}, password: ${emailPasswordList[1]}");
bool foundUser = await searchForUser(emailPasswordList[0], emailPasswordList[1]);
SendPort replyPort = msg[1];
replyPort.send(foundUser);
}
Future sendReceive(SendPort send, message) {
ReceivePort receivePort = ReceivePort();
send.send([message, receivePort.sendPort]);
return receivePort.first;}
I/flutter ( 2073): email: email, password: Passw0rd
E/flutter ( 2073): [ERROR:flutter/runtime/dart_isolate.cc(805)] Unhandled exception:
E/flutter ( 2073): error: native function 'Window_sendPlatformMessage' (4 arguments) cannot be found
E/flutter ( 2073): #0 Window.sendPlatformMessage (dart:ui/window.dart:1089:9)
E/flutter ( 2073): #1 _DefaultBinaryMessenger._sendPlatformMessage (package:flutter/src/services/binary_messenger.dart:85:15)
E/flutter ( 2073): #2 _DefaultBinaryMessenger.send (package:flutter/src/services/binary_messenger.dart:129:12)
E/flutter ( 2073): #3 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:309:51)
E/flutter ( 2073):
E/flutter ( 2073): #4 invokeMethod (package:sqflite/src/sqflite_impl.dart:18:34)
E/flutter ( 2073):
E/flutter ( 2073): #5 SqfliteDatabaseFactoryImpl.invokeMethod (package:sqflite/src/factory_impl.dart:33:7)
E/flutter ( 2073): #6 _SqfliteDatabaseFactoryImpl&Object&SqfliteDatabaseFactoryMixin.safeInvokeMethod. (package:sqflite/src/factory_mixin.dart:22:35)
E/flutter ( 2073): #7 wrapDatabaseException (package:sqflite/src/exception_impl.dart:7:34)
E/flutter ( 2073): .
E/flutter ( 2073): #8 SqfliteDatabaseFactoryImpl.wrapDatabaseException (package:sqflite/src/factory_impl.dart:29:7).
E/flutter ( 2073): #9 _SqfliteDatabaseFactoryImpl&Object&SqfliteDatabaseFactoryMixin.safeInvokeMethod (package:sqflite/src/factory_mixin.dart:22:7).
E/flutter ( 2073): #10 _SqfliteDatabaseFactoryImpl&Object&SqfliteDatabaseFactoryMixin.getDatabasesPath (package:sqflite/src/factory_mixin.dart:136:17).
E/flutter ( 2073):
E/flutter ( 2073): #11 getDatabasesPath. (package:sqflite/sqflite.dart:166:54)
E/flutter ( 2073): #12 UsersSqflite.init (package:himrepo/controller/users_database.dart:20:47).
E/flutter ( 2073): .
E/flutter ( 2073): #13 _LoginPageState.searchForUser. (package:himrepo/ui/login.dart:268:24).
E/flutter ( 2073): .
E/flutter ( 2073): #14 _LoginPageState.callbackFunction(package:himrepo/ui/login.dart:166:28).
E/flutter ( 2073): .
E/flutter ( 2073): #15 _startIsolate.. (dart:isolate-patch/isolate_patch.dart:304:17).
E/flutter ( 2073): #16 _RawReceivePortImpl._handleMessage(dart:isolate-patch/isolate_patch.dart:172:12).
Executing Sqflite method directly gives
E/AndroidRuntime( 6628): FATAL EXCEPTION: Sqflite
E/AndroidRuntime( 6628): java.lang.RuntimeException: Methods marked with #UiThread must be executed on the main thread. Current thread: Sqflite
E/AndroidRuntime( 6628): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:794)
E/AndroidRuntime( 6628): at io.flutter.embedding.engine.FlutterJNI.invokePlatformMessageResponseCallback(FlutterJNI.java:727)
E/AndroidRuntime( 6628): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:140)
E/AndroidRuntime( 6628): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:225)
E/AndroidRuntime( 6628): at com.tekartik.sqflite.SqflitePlugin$6.run(SqflitePlugin.java:778)
E/AndroidRuntime( 6628): at android.os.Handler.handleCallback(Handler.java:873)
E/AndroidRuntime( 6628): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 6628): at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime( 6628): at android.os.HandlerThread.run(HandlerThread.java:65)
Thanks to #pskink for helping. The Isolate works, but I was getting exceptions when running sqflite from a Widget onTap event. It turned out that a plugin (json_annotation) I included in my pubspec.yaml was somehow contributing to the exception: "Methods marked with #UiThread must be executed on the main thread. Current thread: Sqflite". After removing that plugin the app works.