Telephony
Telephony copied to clipboard
Can't Access File() with Background handler
Error:
mostly : [Unhandled Exception: NoSuchMethodError:
sometimes : failed to attach to thread flutter
How to Recreate?
- Initialise Background listener.
- Add
path_provider: ^2.0.9
inpubspec.yaml
- use the following as background method.
static Future<dynamic> myBackgroundMessageHandler(SmsMessage message) async {
print("onBackgroundMessage: " + message.body!);
await getExternalStorageDirectory()
return Future<void>.value();
}
![image](https://user-images.githubusercontent.com/38852291/177406363-23e290cc-2a25-4af7-80d9-d40c22059cde.png)
Update
The error occurs when using this dependency : path_provider: ^2.0.9
I don't know why is is happening but i removed this dependency and replace it with external_path: ^1.0.1
now everything works fine!