I'm using OSX-KVM to run a macOS VM on Fedora, and run an iPhone 14 Pro Max simulator inside it.
Error:
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
#0 PathProviderApi.getDirectoryPath (package:path_provider_foundation/messages.g.dart:40:7)
<asynchronous suspension>
#1 getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:121:24)
<asynchronous suspension>
#2 AppDir.setDir (package:flutter_wpp/entity/app_dir.dart:10:12)
<asynchronous suspension>
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:308:7)
<asynchronous suspension>
#1 invokeMethod (package:sqflite/src/sqflite_impl.dart:16:5)
<asynchronous suspension>
#2 wrapDatabaseException (package:sqflite/src/exception_impl.dart:7:20)
<asynchronous suspension>
#3 SqfliteDatabaseFactoryMixin.getDatabasesPath (package:sqflite_common/src/factory_mixin.dart:177:20)
<asynchronous suspension>
#4 DatabaseFactoryExtension.getDatabasePath (package:floor/src/sqflite_database_factory.dart:23:27)
<asynchronous suspension>
#5 _$WppDbBuilder.build (package:flutter_wpp/db/wpp_db.g.dart:45:11)
<asynchronous suspension>
#6 DbManager.setDb (package:flutter_wpp/db/db_manager.dart:8:16)
<asynchronous suspension>
the flutter_wpp/db/wpp_db.g.dart is generated by floor and works fine on Android.
Here is flutter_wpp/db/db_manager.dart:
import 'package:floor/floor.dart';
import 'wpp_db.dart';
class DbManager {
static WppDb? database;
static setDb() async {
database = await $FloorWppDb
.databaseBuilder('app_database.db')
.addMigrations([]).build();
}
static WppDb get db => database!;
}
Here is flutter_wpp/entity/app_dir.dart:
import 'dart:io';
import 'package:path_provider/path_provider.dart';
class AppDir {
static Directory data = Directory('');
static Directory cache = Directory('');
static setDir() async {
data = await getApplicationDocumentsDirectory();
cache = await getTemporaryDirectory();
}
}
Both getDatabasePath and getApplicationDocumentsDirectory are supposed to work on iOS. I have no idea why those errors happen.