Closed engaref2000 closed 2 years ago
Any updates? Did you manage to resolve this?
generated_plugin_registrant.dart
is a file that automatically created when you enable flutter web (flutter config --enable-web
)
This plugin was not created with web support in mind, but you can do that by forking this project to your own repo and edit it.
Go to your forked project directory, run:
flutter create --template=plugin --platforms=web .
as per stated in this doc
After that go to pubspec.yaml
and edit .flutter.plugin as follow:
plugin:
platforms:
android:
package: id.kakzaki.blue_thermal_printer
pluginClass: BlueThermalPrinterPlugin
ios:
pluginClass: BlueThermalPrinterPlugin
web:
- pluginClass: BlueThermalPrinterPlugin
+ pluginClass: BlueThermalPrinterWeb
+ fileName: blue_thermal_printer_web.dart
Now in your Flutter application project's pubspec.yaml
file, point to your own forked blue_thermal_printer instead of kakzaki's. Run flutter pub get
again, the auto-generated file should now be correct
import 'package:blue_thermal_printer/'; ^ lib/generated_plugin_registrant.dart:15:3: Error: Undefined name 'BlueThermalPrinterPlugin'. BlueThermalPrinterPlugin.registerWith(registrar); ^^^^^^^^^^^^^^^^^^^^^^^^ Failed to compile application.