Register flutter web plugins manually

Viewed 1114

Flutter is generating a file generated_plugin_registrant.dart for web project that looks like

void registerPlugins(PluginRegistry registry) {
  FirestoreWeb.registerWith(registry.registrarFor(FirestoreWeb));
  FirebaseAuthWeb.registerWith(registry.registrarFor(FirebaseAuthWeb));
  FirebaseCoreWeb.registerWith(registry.registrarFor(FirebaseCoreWeb));
  GoogleSignInPlugin.registerWith(registry.registrarFor(GoogleSignInPlugin));
  SharedPreferencesPlugin.registerWith(registry.registrarFor(SharedPreferencesPlugin));
  UrlLauncherPlugin.registerWith(registry.registrarFor(UrlLauncherPlugin));
  registry.registerMessageHandler();
}

I would like to disable some plugins for the web only (FirestoreWeb is crashing because I don't have the proper web initialization and I don't want to). It is not possible to modify it but I would like to know if it is possible to have a custom registerPlugins() that could override the default behavior where I could manually register the plugin I want or disable in pubspec.yaml some plugin for the web only.

0 Answers
Related