Home > Back-end >  Flutter: MissingPluginException(No implementation found for method DocumentReference#set on channel
Flutter: MissingPluginException(No implementation found for method DocumentReference#set on channel

Time:08-31

I'm building windows application by flutter, after adding Firebase packages and connect the app to firebase, I had this problem:

Unhandled Exception: MissingPluginException(No implementation found for method DocumentReference#set on channel plugins.flutter.io/firebase_firestore)

I've tried so many solutions, and searched on the web, but unfortunately all solutions are suit Android not Windows!!!

The idea that I work on, is to upload images to firebase storage, and save data in firestore collections. All firebase services didn't work with me, Authintication, FireStore, and Storage either.

update: This is my function code:

  Future addCategory() async {
    await _userCollectionRef.add({
      'id': '4328',
      'name': cateNameController.text,
      'image': image?.path,
    });

    cateNameController.clear();
    image = null;
    update();
  }
}

And this is my PubSpec.yaml packages code:

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  get: ^4.6.5
  smooth_page_indicator: ^1.0.0 2
  carousel_slider: ^4.1.1
  shared_preferences: ^2.0.15
  flutter_svg: ^1.1.0
  firebase_core: ^1.19.1
  firebase_storage: ^10.3.6
  firebase_auth: ^3.6.4
  firebase_auth_desktop: ^1.0.2
  firebase_core_desktop: ^1.0.2
  google_sign_in: ^5.3.3
  cloud_firestore: ^3.4.5
  firebase_messaging: ^12.0.3
  image_picker: ^0.8.5 3
  image_picker_windows: ^0.1.0 2
  file_picker: ^5.0.1

The Initialize in main() :

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  await initialServices();
  runApp(const MyApp());
}

CodePudding user response:

Official firebase plugins are not supported on windows yet, try this https://www.youtube.com/watch?v=Tw7L2NkhwPc But this plugin does not have firebase_storage support.

CodePudding user response:

If you are using hot restart or hot reload, it won't do the trick. Since Flutter has to inject plugin dependencies into the platform-specific parts of your app, hot restart/hot reload is not enough to trigger the injection. Check this issue for more.

Close the app and execute flutter run command.

  • Related