Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter MissingPluginException:未找到方法的实现_Flutter - Fatal编程技术网

Flutter MissingPluginException:未找到方法的实现

Flutter MissingPluginException:未找到方法的实现,flutter,Flutter,我的flatter应用程序在运行时抛出此异常 MissingPluginException(在channel plugins.flatter.io/path_provider上找不到方法getTemporaryDirectory的实现) 主飞镖 Directory tp = await getTemporaryDirectory(); File tempFile = File('${tp.path}/flutter.pdf'); ByteData bd = await rootBundle.

我的flatter应用程序在运行时抛出此异常

MissingPluginException(在channel plugins.flatter.io/path_provider上找不到方法getTemporaryDirectory的实现)

主飞镖

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);

 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.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  path_provider: ^1.6.9

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/flutter.pdf
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages
name:app
描述:一个新的颤振项目。
#以下行可防止将包意外发布到
#pub.dev使用“pub publish”。这是私人软件包的首选。
发布到:“无”#如果要发布到pub.dev,请删除此行
#下面定义了应用程序的版本和内部版本号。
#版本号是由点分隔的三个数字,如1.2.43
#后跟可选的内部版本号,以+分隔。
#版本和制造商编号都可能在颤振中被覆盖
#通过分别指定--build name和--build number来生成。
#在Android中,版本名用作版本名,而版本号用作版本代码。
#更多关于Android版本控制的信息,请访问https://developer.android.com/studio/publish/versioning
#在iOS中,生成名称用作CbundleShortVersionString,而生成编号用作CbundLeverVersion。
#阅读有关iOS版本控制的更多信息,请访问
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
版本:1.0.0+1
环境:

sdk:“>=2.7.0是否检查了此线程:

是否检查了此线程:

我的类似问题(缺少PluginException)仅在发布版本中出现。 这条线解决了这个问题:

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'

我的类似问题(缺少PluginException)仅在发布版本中出现。 这条线解决了这个问题:

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'

能否请您共享获取错误的代码?并共享您的pubspec.yaml导入的依赖项。我在main的第一行获取错误。dart@Deepika你找到解决方案了吗?运行flutter clean并重新启动应用程序对我来说很有效。你能分享你收到错误的代码吗?和sha您的pubspec.yaml也导入了依赖项。我在main的第一行中得到了错误。dart@Deepika你找到解决方案了吗?运行flutter clean并重新启动应用程序对我很有效。非常感谢!我的应用程序只会在发布版本中抛出错误,这让我非常恼火!非常感谢!我的应用程序只会抛出错误在发布版本上,这让我抓狂!