Telephony icon indicating copy to clipboard operation
Telephony copied to clipboard

Can't Access File() with Background handler

Open XeroDays opened this issue 2 years ago • 2 comments

Error:

mostly : [Unhandled Exception: NoSuchMethodError: sometimes : failed to attach to thread flutter

How to Recreate?

  1. Initialise Background listener.
  2. Add path_provider: ^2.0.9 in pubspec.yaml
  3. use the following as background method.
static Future<dynamic> myBackgroundMessageHandler(SmsMessage message) async {
  print("onBackgroundMessage: " + message.body!);

  await getExternalStorageDirectory()  
  return Future<void>.value();
}

XeroDays avatar Jul 05 '22 19:07 XeroDays

image

XeroDays avatar Jul 05 '22 19:07 XeroDays

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!

XeroDays avatar Jul 07 '22 11:07 XeroDays