kakzaki / blue_thermal_printer

Working with thermal printer via bluetooth (Flutter)
MIT License
164 stars 205 forks source link

(MethodCall) => Null' is not a subtype of type '((MethodCall) => Future<dynamic>)?' #84

Closed zeed-dev closed 2 years ago

zeed-dev commented 3 years ago

════════ Exception caught by widgets library ═══════════════════════════════════ type '(MethodCall) => Null' is not a subtype of type '((MethodCall) => Future)?' in type cast The relevant error-causing widget was

STUCK IN THIS issue please help.

22syamsudar commented 3 years ago

same with... :(

zeed-dev commented 3 years ago

To fix it, replace default constructor in 34 line of blue_thermal_printer.dart from this:

  BlueThermalPrinter._() {
    _channel.setMethodCallHandler((MethodCall call) {
      _methodStreamController.add(call);
    } as Future<dynamic> Function(MethodCall)?);
  }

to this:

BlueThermalPrinter._() {
    _channel.setMethodCallHandler((MethodCall call) async{
      _methodStreamController.add(call);
    });
  }