Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HarryAtSaltus opened this issue Oct 18, 2021 · 9 comments · May be fixed by #74

Comments

@HarryAtSaltus
Copy link

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)

@DeadBryam DeadBryam linked a pull request Oct 22, 2021 that will close this issue
@Mubassir-developer
Copy link

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

DeadBryam@1f15040

@egoan82
Copy link

egoan82 commented Nov 17, 2021

Hello,

I have the same problem, what can I do?

sshot-8

@10urbulut
Copy link

Hello,

I have the same problem, what can I do?

sshot-8

@htetaunglin
Copy link

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

@cazmo99
Copy link

cazmo99 commented Nov 28, 2021

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

@skylastn
Copy link

skylastn commented Feb 5, 2022

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; }); }

@Giuliopretis
Copy link

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

@aharoldk
Copy link

Please fix this simple issue

@YouSour
Copy link

YouSour commented Oct 28, 2022

still not update ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants