概要
Flutterでsqliteを入れる流れでpath_providerを使用した際に少し詰まったため、メモを残しています。
path_providerを依存関係に追加した際、No implementation found for method getApplicationDocumentsDirectory when app is in the backgroundとエラーが出てしまう
バックグラウンドで実装が見つからないよ、と言われてもという感じですが、以下のissueがありました。 github.com
以下のコメントを確認すると、 github.com
Add dependencies on path_provider_android and path_provider_ios. At the beginning of your background isolate entry point, add something like: if (Platform.isAndroid) PathProviderAndroid.registerWith(); if (Platform.isIOS) PathProviderIOS.registerWith();
とあるため、依存関係の追加とコードの追加をします。
path_provider_iosがdiscontinuedになっている
新しく、path_provider_foundationが用意されているようなので、こちらを使用します。 pub.dev