Can't run Flutter web on Chrome Device with BluetoothThermalPrinter package - flutter

Can't run my flutter web app when blue_thermal_printer package is being used.
Compiler show these errors:
import 'package:blue_thermal_printer/';
^
/D:/All%20Data/Softwares/Latest%20Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/blue_thermal_printer-1.1.8/lib/blue_thermal_printer.dart:189:23:
Error: Type 'Registrar' not found.
static registerWith(Registrar value){
^^^^^^^^^
lib/generated_plugin_registrant.dart:31:3: Error: Getter not found: 'BlueThermalPrinterPlugin'.
BlueThermalPrinterPlugin.registerWith(registrar);
What I have tried until now:
1- Tried to enable flutter web support with this command: flutter create .
2- Tried to create a new class BlueThermalPrinterPlugin in the package file blue_thermal_printer.dart with the following method:
class BlueThermalPrinterPlugin{
static var nameoo ;
static registerWith(Registrar value){
this.nameoo=value;
return nameoo;
}
}
But that doesn't either helps because sdk generated automatic generated_plugin_registrant.dart which produces incomplete import i.e import 'package:blue_thermal_printer/'; causing compile time issue.
I need to run my flutter app on web which was working fine a few days before.

Thanks to the developer of this package whom I contacted personally and he corrected the error in packge. blue_thermal_printer 1.2.0 is working fine and doesn't contain this error anymore.

Related

Upgrade to cordova-android 11: Plugin cordova-plugin-video-editor will not work anymore

I just updating my ionic project to Cordova Android 11 (because of android-targetSdkVersion which must be > 30 this fall).
Seems that good old plugin cordova-plugin-video-editor will not work anymore when building the project:
import net.ypresto.androidtranscoder.MediaTranscoder;
^
/Users/olivierschmid/AppDev/b2c-customer-app/platforms/android/app/src/main/java/org/apache/cordova/videoeditor/CustomAndroidFormatStrategy.java:6: error: package net.ypresto.androidtranscoder.format does not exist
import net.ypresto.androidtranscoder.format.MediaFormatStrategy;
^
/Users/olivierschmid/AppDev/b2c-customer-app/platforms/android/app/src/main/java/org/apache/cordova/videoeditor/CustomAndroidFormatStrategy.java:7: error: package net.ypresto.androidtranscoder.format does not exist
import net.ypresto.androidtranscoder.format.OutputFormatUnavailableException;
^
/Users/olivierschmid/AppDev/b2c-customer-app/platforms/android/app/src/main/java/org/apache/cordova/videoeditor/CustomAndroidFormatStrategy.java:14: error: cannot find symbol
public class CustomAndroidFormatStrategy implements MediaFormatStrategy {
Does someone have a tipp what alternative I can try (for compressing videos)? There seem not to be many options?
Thanks! Oli
Have you already tried adding "cordova-plugin-androidx-adapter"?

How do I compile dart sass using flutter in vscode

I have been using vscode with dart sass and flutter, however after my most recent update I am having trouble compiling my dart sass.
Here is the code that was working before:
import 'dart.io';
import 'package:sass/sass.dart' as sass;
id main(List<String> arguments) {
var result = sass.compile(arguments[0]);
new File(arguments[1]).writeAsStringSync(result);
}
As mentioned this was working, however I now get a error come up saying:
'compile' is deprecated and shouldn't be used. Use compileToResult() instead...
I have tried to find a solution but have had no luck. Any help would be greatly appreciated

Flutter Redux Navigation library import error

I have been developing application and one of the libraries I have used was Flutter Redux Navigation. Everything was working fine, until recently, when I started getting following error
../../lib/src/navigation_middleware.dart:3:1: Error: 'NavigationDestination' is imported from both 'package:flutter/src/material/navigation_bar.dart' and 'package:flutter_redux_navigation/src/navigation_destination.dart'.
import 'package:flutter_redux_navigation/src/navigation_destination.dart';
^^^^^^^^^^^^^^^^^^^^^
../../lib/src/navigation_middleware.dart:35:26: Error: 'NavigationDestination' is imported from both 'package:flutter/src/material/navigation_bar.dart' and 'package:flutter_redux_navigation/src/navigation_destination.dart'.
this._setState(NavigationDestination(
^^^^^^^^^^^^^^^^^^^^^
../../lib/src/navigation_middleware.dart:55:26: Error: 'NavigationDestination' is imported from both 'package:flutter/src/material/navigation_bar.dart' and 'package:flutter_redux_navigation/src/navigation_destination.dart'.
this._setState(NavigationDestination(
I even tried to copy example project from their git, and got exactly same error. This is something in library, or perhaps some settings of my IDE? Please let me know if anyone encountered this error.
The problem was that I have upgraded Flutter version from 2.5.1 to 2.8.0. The newest Flutter version contains upgraded Material library, which contains the method called NavigationDestination. Thus both, the library and Material design have the same name of the class, of course, resulting in error.

myfatoorah_flutter import package fails build

I have added myfatoorah_flutter package version 1.0.7 and in file I have imported the package as import 'package:myfatoorah_flutter/myfatoorah_flutter.dart'; it fails the build and gives the following error
../../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/myfatoorah_flutter-1.0.7/lib/myfatoorah_flutter.dart:609:31: Error: The argument type 'bool Function(bool)' can't be assigned to the parameter type 'bool Function(bool, RouteInfo)'.
- 'RouteInfo' is from 'package:back_button_interceptor/src/back_button_interceptor.dart'
('../../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/back_button_interceptor-4.3.1/lib/src/back_button_interceptor.dart').
BackButtonInterceptor.add(myInterceptor);
I have tried following solutions and none of them worked:
changed version of myfatoorah_flutter
switched between channels dev/stable
upgraded flutter sdk
settings.gradle removed and added again
when I remove import line, it works fine, help is required so that I can integrate the payment methods
I am also getting the same error as I tried this way and worked for me.
change version of back_button_interceptor to back_button_interceptor: 4.0.2 in myfatoorah_flutter's pubspec.ymal.

Why the app produced by flutter build web sometimes doesn't work?

I have 2 issues that only appear when executing flutter build web.
Sometimes flutter build web fails complaining (wrongly) about types that were not compatible (see below).
Sometimes the build process finishes but then the web app doesn't work: doesn't display anything and there are no messages in the console.
The error I mention is something like this:
% flutter build web
Target dart2js failed: Exception: lib/main.dart:24:31:
Error: A value of type 'ApiUsersRepository' can't be assigned to a variable of type 'UsersRepository'.
- 'ApiUsersRepository' is from 'package:my_app/api_users_repo.dart' ('lib/api_users_repo.dart').
- 'UsersRepository' is from 'lib/users_repo.dart'.
final UsersRepository usersRepository = ApiUsersRepository();
^
Error: Compilation failed.
The app is working in iOS and web when developing.
The solution
I changed all imports of my files like:
import 'package:my_app/users_repo.dart';
To:
import 'users_repo.dart';
More Details
Investigating the error about types, I found this issue, where the important part is this comment: after changing every import to relative format it resolves my problem.
So I did that, and it solved the 2 issues, the compilation error, and the runtime error.
for me I had to remove a package that was corrupted. c:\src\flutter.pub-cache\hosted\pub.dartlang.org\localstorage-4.0.0+1 Apparently, a file had become corrupted by me invertly. I removed the package and did a flutter pub get then recompiled and it worked.