1
[ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (23720): NoSuchMethodError: Class 'MethodChannel' has no instance method 'invokeMethod' with matching arguments.
E/flutter (23720): Receiver: Instance of 'MethodChannel'
E/flutter (23720): Tried calling: invokeMethod<String>("getApplicationDocumentsDirectory")
E/flutter (23720): Found: invokeMethod(String, [dynamic]) => Future<dynamic>
E/flutter (23720): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
E/flutter (23720): #1      getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:65:22)
E/flutter (23720): <asynchronous suspension>
E/flutter (23720): #2      DatabaseHelper.initializeDb (package:snote/snote/utils/database_helper.dart:45:36)
E/flutter (23720): <asynchronous suspension>
4

1 回答 1

1

出现此问题是因为您使用的不是最新版本的 Dart。我描述了消除此错误的 2 种解决方案。

解决方案1:使用以前版本的Path Provider 即:path_provider: 1.0.0

解决方案 2:如果您想使用最新版本的路径提供程序,请将您的颤振和 Dart 更新到最新版本。

于 2019-05-17T13:20:59.750 回答