Closed gbloggs closed 2 years ago
you can try and exclude generated_plugin_registrant.dart
from analysis, this worked fine for me.
just add in project root a file named analysis_options.yaml
with the following content:
analyzer:
exclude: [lib/generated_plugin_registrant.dart]
reference: https://betterprogramming.pub/dont-panic-when-flutter-generates-a-bad-file-for-you-e5e314c2b01
Hi... That makes sense, and has meant the the analyze passed. Is there a way to tell the build not to include this plugin? We use many more plugings, but it seems to have only included ones that have an _web component, which this bluetooth printer one does not. I think I understand why it was failing the analyze, there is no web plugin, but we have used this plugin for a few months now and this has only just happened, from v1.1.8.
Furthermore, whilst adding the exclude allows analyze to pass, building for web fails:
flutter build web
💪 Building with sound null safety 💪
Compiling lib/main.dart for the Web...
Target dart2js failed: Exception: lib/generated_plugin_registrant.dart:8:8:
Error: Error when reading '../../../.pub-cache/hosted/pub.dartlang.org/blue_thermal_printer-1.1.8/lib/': Error reading '../../../.pub-cache/hosted/pub.dartlang.org/blue_thermal_printer-1.1.8/lib/' (Is a directory)
import 'package:blue_thermal_printer/';
^
lib/generated_plugin_registrant.dart:25:3:
Error: Getter not found: 'BlueThermalPrinterPlugin'.
BlueThermalPrinterPlugin.registerWith(registrar);
^^^^^^^^^^^^^^^^^^^^^^^^
Error: Compilation failed.
I've just updated flutter. The issue remains in 2.5.2 too:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.19043.1266], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] Connected device (3 available)
• No issues found!
Ok. Further to this, iOS builds are failing too for me.
Getting the following build error in Runner/GeneratedPluginRegistrant.m:
//
// Generated file. Do not edit.
//
// clang-format off
#import “GeneratedPluginRegistrant.h”
#if __has_include(<blue_thermal_printer/FlutterBluePlugin.h>)
#import <blue_thermal_printer/FlutterBluePlugin.h>
#else
@import blue_thermal_printer;
#endif
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
After upgrading to v1.1.8 and running analyze, the analyze is failing with the following error:
I'm not sure what this file does but seems very web related:
The generated file looks like this: