首页 > 解决方案 > Flutter - MissingPluginException(在通道 plugins.flutter.io/image_picker 上找不到方法 pickImage 的实现)

问题描述

我正在尝试使用 image_picker 包从图库中选择图像,无论如何这个错误都会持续存在。我已经尝试过的解决方案

  1. 终止、清理、重新运行、重新启动 IDE 和重新启动 PC
  2. 更改 compileSdkVersion 和 targetSdkVersion
  3. 降级软件包版本
Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker)
E/flutter ( 2928): #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157:7)
E/flutter ( 2928): <asynchronous suspension>
E/flutter ( 2928): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)

我用来获取图像的功能:

void getPicture() async{

    final picker = ImagePicker();
    final pickedFile = await picker.getImage(source: ImageSource.gallery);
    _image = File(pickedFile.path);
    _picLink = await dbOnlineInstance.uploadProfilePic(_image, authInstance.firebaseAuthInstance.currentUser.email);

    notifyListeners();
  }

例如,某些软件包是否会因冲突而禁用其他软件包?我安装的软件包:

  cupertino_icons: ^0.1.3
  splashscreen:
  provider:
  route_transitions:
  flutter_vector_icons:
  simple_animations:
  supercharged:
  animated_background:
  sqflite:
  path:
  toggle_switch:
  firebase_auth:
  firebase_core:
  cloud_firestore:
  image_picker:
  shared_preferences:
  cached_network_image:
  firebase_storage:
  google_sign_in:
  flutter_facebook_auth:
  draggable_widget:
  enum_to_string:
  stacked:
  auto_route:
  stacked_services:
  get_it:
  injectable:

还是权限问题?虽然这个包不需要权限并且错误本身与权限无关。

标签: flutterflutter-dependencies

解决方案


我遇到了与您类似的问题,但我的问题介于flutter_facebook_authsqflite之间。

我收到(在执行“flutter run”之后):未处理的异常:MissingPluginException(在通道 com.tekartik.sqflite.SqflitePlugin 上找不到方法 getDatabasesPath 的实现)

解决方案是在阅读@Ismaeil Ghouneim回复后,谢谢

我在这里按照本教程进行了所有配置:https ://facebook.meedu.app/#/一切都恢复正常了!


推荐阅读