我的 flutter 应用程序在运行时抛出此异常。
MissingPluginException(在通道plugins.flutter.io/path_provider上找不到方法getTemporaryDirectory的实现)
主程序.dart
Directory tp = await getTemporaryDirectory();
File tempFile = File('${tp.path}/flutter.pdf');
ByteData bd = await rootBundle.load('assets/flutter.pdf');
tempFile=await tempFile.writeAsBytes(bd.buffer.asUint8List(), flush: true);
Run Code Online (Sandbox Code Playgroud)
pupspec.yaml
name: flutterapp
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# …
Run Code Online (Sandbox Code Playgroud) flutter ×1