MM Gè
MM Gè

Reputation: 11

Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null) #0 PathProviderApi.getDirectoryPath

I am getting the following exception while running flutter on ios emulator. the app is initialized but the screen is blank. when running on android it works - the exception is only on ios.

Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
#0      PathProviderApi.getDirectoryPath (package:path_provider_foundation/messages.g.dart:39:7)
<asynchronous suspension>
#1      getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:120:24)
<asynchronous suspension>
#2      main (package:main.dart:90:19)
<asynchronous suspension>

this is my code:

late Directory docsDirectory;

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  print('printing');
  docsDirectory = await getApplicationDocumentsDirectory();
  print('not printing');
  runApp(MyApp());
}

Upvotes: 1

Views: 166

Answers (0)

Related Questions