bluetooth_print icon indicating copy to clipboard operation
bluetooth_print copied to clipboard

Error running this package's example app: type '(MethodCall) => Null' is not a subtype of type '((MethodCall) => Future<dynamic>)?' in type castW

Open HarryAtSaltus opened this issue 2 years ago • 9 comments

When I execute the example app included in the package, the following error occurs.

════════ Exception caught by widgets library ═══════════════════════════════════ The following _CastError was thrown attaching to the render tree: type '(MethodCall) => Null' is not a subtype of type '((MethodCall) => Future)?' in type cast

When the exception was thrown, this was the stack #0 new BluetoothPrint._ package:bluetooth_print/bluetooth_print.dart:26 #1 BluetoothPrint._instance package:bluetooth_print/bluetooth_print.dart:29 #2 BluetoothPrint._instance (package:bluetooth_print/bluetooth_print.dart) package:bluetooth_print/bluetooth_print.dart:1 #3 BluetoothPrint.instance package:bluetooth_print/bluetooth_print.dart:31 #4 new _MyAppState package:print_ticket/main.dart:17 #5 MyApp.createState package:print_ticket/main.dart:13 #6 new StatefulElement package:flutter/…/widgets/framework.dart:4754 #7 StatefulWidget.createElement package:flutter/…/widgets/framework.dart:737 #8 Element.inflateWidget package:flutter/…/widgets/framework.dart:3668 #9 Element.updateChild package:flutter/…/widgets/framework.dart:3425 #10 RenderObjectToWidgetElement._rebuild package:flutter/…/widgets/binding.dart:1198 #11 RenderObjectToWidgetElement.mount package:flutter/…/widgets/binding.dart:1167 #12 RenderObjectToWidgetAdapter.attachToRenderTree. package:flutter/…/widgets/binding.dart:1112 #13 BuildOwner.buildScope package:flutter/…/widgets/framework.dart:2573 #14 RenderObjectToWidgetAdapter.attachToRenderTree package:flutter/…/widgets/binding.dart:1111 #15 WidgetsBinding.attachRootWidget package:flutter/…/widgets/binding.dart:944 #16 WidgetsBinding.scheduleAttachRootWidget. package:flutter/…/widgets/binding.dart:924 (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)

HarryAtSaltus avatar Oct 18 '21 19:10 HarryAtSaltus

Not a good practice, but you can change the below changes manually in the package.

https://github.com/DeadBryam/bluetooth_print/commit/1f15040f674b2f593f83b595cc2b9dc29569309e

Mubassir-developer avatar Oct 25 '21 00:10 Mubassir-developer

Hello,

I have the same problem, what can I do?

sshot-8

egoan82 avatar Nov 17 '21 22:11 egoan82

Hello,

I have the same problem, what can I do?

sshot-8

10urbulut avatar Nov 22 '21 07:11 10urbulut

I have also this issue. Screen Shot 2021-11-28 at 12 08 27 AM

htetaunglin avatar Nov 27 '21 17:11 htetaunglin

hello, I am also having the same issue. Hopefully it will be resolved. Thank you

cazmo99 avatar Nov 28 '21 14:11 cazmo99

just change your package code -> bluetooth_print.dart from : BluetoothPrint._() { _channel.setMethodCallHandler((MethodCall call) { _methodStreamController.add(call); return; } as Future<dynamic> Function(MethodCall)?); }

to this:

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

skylastn avatar Feb 05 '22 10:02 skylastn

This error breaks the package, they should fix this as soon as possible.

Giuliopretis avatar Mar 21 '22 14:03 Giuliopretis

Please fix this simple issue

aharoldk avatar Jul 17 '22 11:07 aharoldk

still not update ?

YouSour avatar Oct 28 '22 07:10 YouSour