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

blue.getDevices() not working on Mac Chrome browser #2

Open
rohitsangwan01 opened this issue Mar 5, 2022 · 6 comments
Open

blue.getDevices() not working on Mac Chrome browser #2

rohitsangwan01 opened this issue Mar 5, 2022 · 6 comments

Comments

@rohitsangwan01
Copy link

await blue.getDevices();
throws Error
TypeError: Cannot read properties of undefined (reading 'apply')

on GoogleChrome (Mac os M1)

Tried With your Example App too , but Same error

Complete Error :-

TypeError: Cannot read properties of undefined (reading 'apply')
at Object.callMethod$ [as callMethod] (http://localhost:55502/dart_sdk.js:62467:22)
at web_blue.Blue..callMethod (http://localhost:55502/packages/web_blue/src/js_facade.dart.lib.js:30:24)
at web_blue.Blue.
.getDevices (http://localhost:55502/packages/web_blue/web_blue.dart.lib.js:54:26)
at PairedDevices (http://localhost:55502/packages/nerbio_d/app/modules/scan_device/scan_device_controller.dart.lib.js:31:47)
at PairedDevices.next ()
at runBody (http://localhost:55502/dart_sdk.js:40590:34)
at Object._async [as async] (http://localhost:55502/dart_sdk.js:40621:7)
at scan_device_controller.ScanDeviceController.new.PairedDevices (http://localhost:55502/packages/nerbio_d/app/modules/scan_device/scan_device_controller.dart.lib.js:29:20)
at http://localhost:55502/packages/nerbio_d/app/modules/scan_device/scan_device_view.dart.lib.js:333:801
at ink_well._InkResponseState.new.[_handleTap] (http://localhost:55502/packages/flutter/src/material/icon_button.dart.lib.js:40468:31)
at tap.TapGestureRecognizer.new.invokeCallback (http://localhost:55502/packages/flutter/src/gestures/recognizer.dart.lib.js:190:18)
at tap.TapGestureRecognizer.new.handleTapUp (http://localhost:55502/packages/flutter/src/gestures/tap.dart.lib.js:409:40)
at tap.TapGestureRecognizer.new.[_checkUp] (http://localhost:55502/packages/flutter/src/gestures/tap.dart.lib.js:217:12)
at tap.TapGestureRecognizer.new.handlePrimaryPointer (http://localhost:55502/packages/flutter/src/gestures/tap.dart.lib.js:166:23)
at tap.TapGestureRecognizer.new.handleEvent (http://localhost:55502/packages/flutter/src/gestures/recognizer.dart.lib.js:426:16)
at pointer_router.PointerRouter.new.[_dispatch] (http://localhost:55502/packages/flutter/src/gestures/pointer_router.dart.lib.js:86:9)
at http://localhost:55502/packages/flutter/src/gestures/pointer_router.dart.lib.js:112:26
at LinkedMap.new.forEach (http://localhost:55502/dart_sdk.js:27679:11)
at pointer_router.PointerRouter.new.[_dispatchEventToRoutes] (http://localhost:55502/packages/flutter/src/gestures/pointer_router.dart.lib.js:110:29)
at pointer_router.PointerRouter.new.route (http://localhost:55502/packages/flutter/src/gestures/pointer_router.dart.lib.js:105:37)
at binding$5.WidgetsFlutterBinding.new.handleEvent (http://localhost:55502/packages/flutter/src/gestures/binding.dart.lib.js:364:26)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:55502/packages/flutter/src/gestures/binding.dart.lib.js:352:24)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:55502/packages/flutter/src/rendering/layer.dart.lib.js:5427:13)
at binding$5.WidgetsFlutterBinding.new.[_handlePointerEventImmediately] (http://localhost:55502/packages/flutter/src/gestures/binding.dart.lib.js:328:14)
at binding$5.WidgetsFlutterBinding.new.handlePointerEvent (http://localhost:55502/packages/flutter/src/gestures/binding.dart.lib.js:302:43)
at binding$5.WidgetsFlutterBinding.new.[_flushPointerEventQueue] (http://localhost:55502/packages/flutter/src/gestures/binding.dart.lib.js:292:14)
at binding$5.WidgetsFlutterBinding.new.[_handlePointerDataPacket] (http://localhost:55502/packages/flutter/src/gestures/binding.dart.lib.js:283:54)
at Object.invoke1 (http://localhost:55502/dart_sdk.js:190405:7)
at _engine.EnginePlatformDispatcher..invokeOnPointerDataPacket (http://localhost:55502/dart_sdk.js:171081:15)
at _engine.PointerBinding.
.[_onPointerData] (http://localhost:55502/dart_sdk.js:171963:49)
at http://localhost:55502/dart_sdk.js:172401:28
at http://localhost:55502/dart_sdk.js:172357:16
at loggedHandler (http://localhost:55502/dart_sdk.js:172062:11)

@Sunbreak
Copy link
Collaborator

Sunbreak commented Mar 5, 2022

Could you post you flutter doctor -v?

@rohitsangwan01
Copy link
Author

@Sunbreak here it is

[✓] Flutter (Channel stable, 2.10.2, on macOS 12.2.1 21D62 darwin-arm, locale en-IN)
• Flutter version 2.10.2 at /Users/rohitsangwan/fvm/versions/stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 097d3313d8 (2 weeks ago), 2022-02-18 19:33:08 -0600
• Engine revision a83ed0e5e3
• Dart version 2.16.1
• DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/rohitsangwan/Library/Android/sdk
• Platform android-32, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.65.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.36.0

[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.2.1 21D62 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.51

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!

@Sunbreak
Copy link
Collaborator

Sunbreak commented Mar 5, 2022

TypeError: Cannot read properties of undefined (reading 'apply')

It probably indicates that navigator.blue is unavailable.

  • What is the result of canUseBlue() and blue.getAvailability()?
  • Did you call blue.requestDevice() before blue.getDevices()

@rohitsangwan01
Copy link
Author

rohitsangwan01 commented Mar 5, 2022

@Sunbreak both are true , canUseBlue() and getAvailability , and yes i tried both ways ,
tried to call request device after getDevice and viceVersa

and bro how to get Device Id and Name from BlueDevice ??

@Sunbreak
Copy link
Collaborator

Sunbreak commented Mar 6, 2022

@Sunbreak both are true , canUseBlue() and getAvailability , and yes i tried both ways , tried to call request device after getDevice and viceVersa

Then something inside Dart-JS interop breaks, you could file issue on Flutter repo, i.e. flutter/flutter#97357

and bro how to get Device Id and Name from BlueDevice ??

You could PR like this: 0e6601b, according to https://developer.mozilla.org/en-US/docs/Web/API/BluetoothDevice#properties,

@rohitsangwan01
Copy link
Author

@Sunbreak okk Thanks , will try

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

No branches or pull requests

2 participants