I am writing a code to upload pdf file to Firebase Storage and used the package: FilePicker but it is throwing an error when trying to pick the file. I have already tried flutter clean
and rebuilding the project.
Error
I/flutter (30101): [MethodChannelFilePicker] Unsupported operation.
Method not found. The exception thrown was:
MissingPluginException(No implementation found for method any on channel miguelruivo.flutter.plugins.filepicker)
E/flutter (30101): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled
Exception: MissingPluginException(No implementation found for method any on channel
miguelruivo.flutter.plugins.filepicker)
My code to pick the file
final result=await FilePicker.platform.pickFiles();
if(result==null){
return;
}else{
setState(() {
PlatformFile pdfFile=result.files.first;
});
}
2
Answers
Usually when you face an exception
MissingPluginException
the reason is not fully builded project. It means you have added some dependency in yourpubspec.yaml file
and you didn’t rebuild your project. Try to stop and run it. Also you can try to doflutter clean && flutter pub get && flutter run
if stop/start not helps.some times if you add a plugin in yaml file when it is running it will happen.
try to stop the app.
then ->
Flutter clean
then ->flutter pub get
then run you project.