dotintent / flutterblelib Goto Github PK
View Code? Open in Web Editor NEWBluetooth Low Energy library for Flutter with support for simulating peripherals
License: Apache License 2.0
Bluetooth Low Energy library for Flutter with support for simulating peripherals
License: Apache License 2.0
Any updates of when you are planning to continue to support this library?
Btw I'm a huge fan of your android lib and it's very frustrating to see that you cannot use your library on flutter.
import 'package:flutter_ble_lib_example/ui/ble_devieces_screen.dart';
from (https://pub.dartlang.org/packages/flutter_ble_lib#-example-tab-) seems to be a typo and should read "devices", correct?
hi,
i'm trying to use flutter blelib package to develop an app (android and ios), i can not take advertisement data (rawdata scanrecord byte[] ).
=> how to get all value of raw data?,
=> and is it possible to take raw data both android and ios?,
could you please help me..,
I have a problem to maintain a clean connection with a Bluetooth module (ESP32-S). I use the scan example of the library and modify it a little to connect and seems to do the job. But when I use MaterialPageRoute to switch to my app the connection sometimes crashes ..
What is the good way to maintain this connection between the differents Page of my app ?
i get the error
Attribute application@label value=... from AndroidManifest.xml:17:9-36
is also present at [com.polidea.rxandroidble:rxandroidble:1.4.3] AndroidManifest.xml:16:18-50 value=(@string/app_name).
when compiling when using the package. without the package everything compiles fine.
The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.
Because flutter_ble_lib depends on protobuf >=0.2.0 <=0.9.0 which requires SDK version >=0.7.5 <2.0.0-∞, version solving failed.
pub upgrade failed (1)
I'm using this library to connect to some arduino board with BLE support (https://www.dfrobot.com/wiki/index.php/Bluno_SKU:DFR0267).
After calling FlutterBleLib.instance.connectToDevice, i'm getting BleDevice object
which has isConnected always set to false.
The same is for FlutterBleLib.instance.onDeviceConnectionChanged().
I'm using this library by calling methods in following order
FlutterBleLib.instance.createClient
FlutterBleLib.instance.onDeviceConnectionChanged()
FlutterBleLib.instance.connectToDevice
And later
FlutterBleLib.instance.discoverAllServicesAndCharacteristicsForDevice
FlutterBleLib.instance.writeCharacteristicForDevice
But this parts is working fine.
Hi,
Scan list is empty. BluetoothAdapter(22120): 616386226: getState(). Returning 12
in console probably means that everything is OK. I can see one bluetooth device in my Android > Settings. Permissions for the example app on the Android device look OK. Android OS is 5.1.
It all looks exactly the same with the flutter_blue
example, by the way. I suspect I should clear my target device settings somehow, but I am at a loss. Any ideas?
Hello All!
Does this library have the ability to extract the advertisement data when a ble device has been detected?
I did not see it covered in the documentation anywhere.
Sorry if I messed it!
Best Regards,
Tim
I/flutter (25554): The following assertion was thrown building InfoScreen(dirty):
I/flutter (25554): type 'List<.dynamic>' is not a subtype of type 'List<.Checkbox>' where
I/flutter (25554): List is from dart:core
I/flutter (25554): List is from dart:core
I/flutter (25554): Checkbox is from package:flutter/src/material/checkbox.dart
I/flutter (25554):
I/flutter (25554): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (25554): more information in this error message to help you determine and fix the underlying cause.
I/flutter (25554): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (25554): https://github.com/flutter/flutter/issues/new
I/flutter (25554):
I/flutter (25554): When the exception was thrown, this was the stack:
I/flutter (25554): #0 InfoScreen.build (package:flutter_ble_lib_example/ui/screen_on_boarding.dart:112:44)
Is it possible to receive BLE service notification in the activity that is running in background? I want to continuously monitor hear rate measurement while the user switching between different applications.
The following is the printed data:
MonitorCharacteristic : [transactionId = , characteristic = Characteristic : [id = 0.0, uuid = , serviceId = 0, serviceUuid = , deviceId = , flags =0, value = ]
The Android is normal.
While running with xcode on device, I discover my BT device, connect to it and find the service I want to. On trying to write to the "characteristic" a hex value of 0x289 / 0x0289 / 0x2, all of them fail with the following error.
Invalid argument (Not a byte value at index 0: 0x289): Instance(length:1) of '_GrowableList'
#0 _Base64Encoder.encodeChunk (dart:convert/base64.dart:392:5)
#1 _Base64Encoder.encode (dart:convert/base64.dart:346:9)
#2 Base64Encoder.convert (dart:convert/base64.dart:253:32)
#3 Codec.encode (dart:convert/codec.dart:25:32)
#4 FlutterBleLib.writeCharacteristic (file:///Users/satyajits/dev/flutter/FlutterBleLib/lib/source/lib_core.dart:268:30)
This however works with the ios bluetooth app, LightBlue.
Is there any plans to support Gatt peripheral role?
Console shown list of onScanResult();
How can I get mManufacturerSpecificData ?
D/BluetoothLeScanner(31044): onScanResult() - ScanResult{mDevice=3D:14:34:32:FC:E7, mScanRecord=ScanRecord [mAdvertiseFlags=-1, mServiceUuids=null, mManufacturerSpecificData={6=[1, 9, 32, 2, -108, -121, -70, 22, 81, 7, 57, -88, 73, -77, -42, 3, -96, 85, 53, -89, -83, 114, -128, 15, -123, -61, 121]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-41, mTimestampNanos=2112780591420409}
Failed to create FlutterBleLib instance using createClient(..) method..
OS: Mac
Platform: Android
Device: Nexus 5
Exception stack trace.
###############type 'Future' is not a subtype of type 'Future' where
Future is from dart:async
Future is from dart:async
Null is from dart:core
EXCEPTION: _TypeError
type 'Future' is not a subtype of type 'Future' where
Future is from dart:async
Future is from dart:async
Null is from dart:core
STACK TRACE:
#0 FlutterBleLib.createClient (file:///Users/user1/FlutterDevelopment/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ble_lib-1.0.0/lib/source/lib_core.dart:38:26)
#1 _MyHomePageState._incrementCounter (file:///Users/user1/FlutterDevelopment/FlutterProjects/flutter_ble/lib/main.dart:59:30)
#2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
#3 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:549:30)
#4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
#5 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
#6 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
#7 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
#8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
#9 PointerRouter.route (package:flutter/
When trying to run application with new flutter.io i'm getting following error
I/FlutterActivityDelegate(15704): onResume setting current activity to this
E/flutter (15704): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (15704): type 'Future<dynamic>' is not a subtype of type 'Future<Null>' where
E/flutter (15704): Future is from dart:async
E/flutter (15704): Future is from dart:async
E/flutter (15704): Null is from dart:core
E/flutter (15704):
E/flutter (15704): #0 FlutterBleLib.createClient (file:///home/pablo/.pub-cache/hosted/pub.dartlang.org/flutter_ble_lib-1.0.0/lib/source/lib_core.dart:38:26)
E/flutter (15704): #1 new MyApp (package:flutter_control_app/my_app.dart:8:28)
E/flutter (15704): #2 main (file:///home/pablo/AndroidStudioProjects/flutter_control_app/lib/main.dart:11:14)
E/flutter (15704): #3 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:279:19)
E/flutter (15704): #4 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
Where i'm calling createClient with following way
FlutterBleLib.instance.createClient(null)
If i disable dart 2.0 mode, it's starting without errors
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.2.8, on Linux, locale pl_PL.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] Android Studio (version 3.1)
[✓] VS Code (version 1.22.2)
[✓] Connected devices (1 available)
Edit 1:
More details flutter/flutter#15654 and pauldemarco/flutter_blue#51
On the surface, it feels like a flutter issue but it is not. Flutter run fails to install on both iOS (running 11.4) and Android device. Running the example project directly with xcode succeeds but unfortunately I can't debug any issues with it.
Launches on simulator as well. Also, all the other flutter apps I have run fine on the device so I am guessing something with the project config is off.
When trying to connect, sometimes, I'm getting the attached crash, I haven't identified any steps but it's quite constant, I can see the same crash when I try to cancel the connection (disconnect) after requesting a connection.
D/BluetoothGatt( 1277): onClientConnectionState() - status=133 clientIf=9 device=20:91:48:CA:DF:XX D/BluetoothManager( 1277): getConnectionState() D/BluetoothManager( 1277): getConnectedDevices W/BluetoothGatt( 1277): Unhandled exception in callback W/BluetoothGatt( 1277): rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError W/BluetoothGatt( 1277): at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:187) W/BluetoothGatt( 1277): at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorUnsubscribeOn$1.onError(OperatorUnsubscribeOn.java:47) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.onError(OperatorSubscribeOn.java:80) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852) W/BluetoothGatt( 1277): at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44) W/BluetoothGatt( 1277): at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28) W/BluetoothGatt( 1277): at rx.Observable.unsafeSubscribe(Observable.java:10256) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:248) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148) W/BluetoothGatt( 1277): at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77) W/BluetoothGatt( 1277): at rx.internal.operators.NotificationLite.accept(NotificationLite.java:135) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorReplay$UnboundedReplayBuffer.replay(OperatorReplay.java:903) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorReplay$ReplaySubscriber.replay(OperatorReplay.java:636) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorReplay$ReplaySubscriber.onNext(OperatorReplay.java:452) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:395) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:355) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$InnerSubscriber.onNext(OperatorMerge.java:846) W/BluetoothGatt( 1277): at com.jakewharton.rxrelay.RelaySubscriptionManager$RelayObserver.onNext(RelaySubscriptionManager.java:205) W/BluetoothGatt( 1277): at com.jakewharton.rxrelay.PublishRelay.call(PublishRelay.java:47) W/BluetoothGatt( 1277): at com.polidea.rxandroidble.internal.connection.DisconnectionRouter.onDisconnectedException(DisconnectionRouter.java:65) W/BluetoothGatt( 1277): at com.polidea.rxandroidble.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:76) W/BluetoothGatt( 1277): at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:228) W/BluetoothGatt( 1277): at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:70) W/BluetoothGatt( 1277): at android.os.Binder.execTransact(Binder.java:573) W/BluetoothGatt( 1277): Caused by: rx.exceptions.CompositeException: 2 exceptions occurred. W/BluetoothGatt( 1277): ... 40 more W/BluetoothGatt( 1277): Caused by: rx.exceptions.CompositeException$CompositeExceptionCausalChain: Chain of Causes for CompositeException In Order Received => W/BluetoothGatt( 1277): at android.util.Log.printlns(Log.java:584) W/BluetoothGatt( 1277): at android.util.Log.w(Log.java:276) W/BluetoothGatt( 1277): at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:230) W/BluetoothGatt( 1277): ... 2 more W/BluetoothGatt( 1277): Caused by: com.polidea.rxandroidble.exceptions.BleDisconnectedException: Disconnected from 20:91:48:CA:DF:6F W/BluetoothGatt( 1277): at com.polidea.rxandroidble.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:76) W/BluetoothGatt( 1277): at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:228) W/BluetoothGatt( 1277): ... 2 more W/BluetoothGatt( 1277): Caused by: java.lang.IllegalArgumentException: Unsupported value: com.polidea.rxandroidble.exceptions.BleDisconnectedException: Disconnected from 20:91:48:CA:DF:6F W/BluetoothGatt( 1277): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:293) W/BluetoothGatt( 1277): at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:70) W/BluetoothGatt( 1277): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:199) W/BluetoothGatt( 1277): at com.polidea.flutterblelib.FlutterBleLibPlugin$DefaultOnErrorAction.onError(FlutterBleLibPlugin.java:449) W/BluetoothGatt( 1277): at com.polidea.flutterblelib.utils.SafeAction.onError(SafeAction.java:21) W/BluetoothGatt( 1277): at com.polidea.flutterblelib.BleHelper$11.onError(BleHelper.java:401) W/BluetoothGatt( 1277): at rx.internal.util.ObserverSubscriber.onError(ObserverSubscriber.java:39) W/BluetoothGatt( 1277): at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:153) W/BluetoothGatt( 1277): at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorUnsubscribeOn$1.onError(OperatorUnsubscribeOn.java:47) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.onError(OperatorSubscribeOn.java:80) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.observers.Subscribers$5.onError(Subscribers.java:230) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852) W/BluetoothGatt( 1277): at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44) W/BluetoothGatt( 1277): at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28) W/BluetoothGatt( 1277): at rx.Observable.unsafeSubscribe(Observable.java:10256) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:248) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148) W/BluetoothGatt( 1277): at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77) W/BluetoothGatt( 1277): at rx.internal.operators.NotificationLite.accept(NotificationLite.java:135) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorReplay$UnboundedReplayBuffer.replay(OperatorReplay.java:903) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorReplay$ReplaySubscriber.replay(OperatorReplay.java:636) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorReplay$ReplaySubscriber.onNext(OperatorReplay.java:452) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:395) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:355) W/BluetoothGatt( 1277): at rx.internal.operators.OperatorMerge$InnerSubscriber.onNext(OperatorMerge.java:846) W/BluetoothGatt( 1277): at com.jakewharton.rxrelay.RelaySubscriptionManager$RelayObserver.onNext(RelaySubscriptionManager.java:205) W/BluetoothGatt( 1277): at com.jakewharton.rxrelay.PublishRelay.call(PublishRelay.java:47) W/BluetoothGatt( 1277): at com.polidea.rxandroidble.internal.connection.DisconnectionRouter.onDisconnectedException(DisconnectionRouter.java:65) W/BluetoothGatt( 1277): ... 4 more D/BluetoothGatt( 1277): close() D/BluetoothGatt( 1277): unregisterApp() - mClientIf=9
Dear All,
I’m looking for Blue-tooth low energy MESH source code on flutter for Android/IOS. but I’m not getting the flutter source code . please someone help me on this.
**Questions :-
Thanks
Happens instantly, in FlutterBleLib code.
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-US)
• Flutter version 0.1.5 at /Users/jackivers/Projects/Flutter/flutter
• Framework revision 3ea4d06340 (4 weeks ago), 2018-02-22 11:12:39 -0800
• Engine revision ead227f118
• Dart version 2.0.0-dev.28.0.flutter-0b4f01f759
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/jackivers/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.4.0
[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] VS Code (version 1.21.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Dart Code extension version 2.10.0
[✓] Connected devices (2 available)
• SM J730GM • 5200f375b274b4d9 • android-arm • Android 7.0 (API 24) (emulator)
• JSI iPhone X • 7abb1638e5f94117408869c9c5236c5acb0d7f0c • ios • iOS 11.2.6
This is very similar to #19, if not equal.
Don't know if I'm doing something wrong (likely) or the issue is actually back.
The steps to reproduce are:
minSdkVersion
to 18 (build.gradle)tools:replace="android:label"
to the application tag (in AndroidManifest.xml)main.dart
with this oneI don't know if Items 2 and 3 are necessary, but I wasn't able to debug without them.
When I click the button that calls _createClient
(and FlutterBleLib.instance.createClient(null)
) I get the following:
I/flutter (12924): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
I/flutter (12924): The following assertion was thrown while handling a gesture:
I/flutter (12924): type 'Future<dynamic>' is not a subtype of type 'Future<Null>'
I/flutter (12924):
I/flutter (12924): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (12924): more information in this error message to help you determine and fix the underlying cause.
I/flutter (12924): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (12924): https://github.com/flutter/flutter/issues/new
I/flutter (12924):
I/flutter (12924): When the exception was thrown, this was the stack:
I/flutter (12924): #0 FlutterBleLib.createClient (file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ble_lib-1.0.0/lib/source/lib_core.dart:38:26)
I/flutter (12924): #1 _MyHomePageState._createClient (file:///C:/Users/mauri/AndroidStudioProjects/irrigacao_ble/lib/main.dart:31:28)
I/flutter (12924): #2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
I/flutter (12924): #3 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
I/flutter (12924): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
I/flutter (12924): #5 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
I/flutter (12924): #6 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
I/flutter (12924): #7 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
I/flutter (12924): #8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
I/flutter (12924): #9 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
I/flutter (12924): #10 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
I/flutter (12924): #11 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
I/flutter (12924): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
I/flutter (12924): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
I/flutter (12924): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
I/flutter (12924): #15 _invoke1 (dart:ui/hooks.dart:134:13)
I/flutter (12924): #16 _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
I/flutter (12924):
I/flutter (12924): Handler: onTap
I/flutter (12924): Recognizer:
I/flutter (12924): TapGestureRecognizer#f8bd3(debugOwner: GestureDetector, state: possible, won arena, finalPosition:
I/flutter (12924): Offset(332.0, 597.3), sent tap down)
I/flutter (12924): ════════════════════════════════════════════════════════════════════════════════════════════════════
Here's my doctor's summary:
[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [versão 10.0.17134.165], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[√] Android Studio (version 3.1)
[√] IntelliJ IDEA Ultimate Edition (version 2018.1)
[√] VS Code, 64-bit edition (version 1.25.1)
[√] Connected devices (1 available)
I have implemented a fix for this in a fork
I am getting an immediate crash as soon as FlutterBleLib.instance.startDeviceScan
is called. Crash log attached. Same general symptoms as #13 -- immediate crash in FlutterBleLib code.
Runner 3-22-18, 2-20 PM.crash.zip
`[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-US)
• Flutter version 0.1.5 at /Users/jackivers/Projects/Flutter/flutter
• Framework revision 3ea4d06340 (4 weeks ago), 2018-02-22 11:12:39 -0800
• Engine revision ead227f118
• Dart version 2.0.0-dev.28.0.flutter-0b4f01f759
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/jackivers/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.4.0
[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] VS Code (version 1.21.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Dart Code extension version 2.10.0
[✓] Connected devices (1 available)
• JSI iPhone X • 7abb1638e5f94117408869c9c5236c5acb0d7f0c • ios • iOS 11.2.6
• No issues found!
`
I have a characteristic which I can write to (using ios app LightBlue) but which fails the write with type string. Hex writes don't work because of issue #29
Attached is the details from the service and characteristic.
Description of the overall architecture. It should cover both libraries (RN and Flutter along with simulator and description of a layer that the simulator could be plugged in)
I am taking a project that was working with the flutter_blue library and attempting to switch it over to flutter_ble_lib but builds are failing.
First failure is on pod install, I get:
Installing flutter_ble_lib (0.0.1) [!] Pods written in Swift can only be integrated as frameworks; add
use_frameworks! to your Podfile or target to opt into using it. The Swift Pods being used are: RxBluetoothKit, RxSwift, and flutter_ble_lib
I tried adding add use_frameworks!
to the Podfile but that leads to more problems relating to Swift:
`=== BUILD TARGET RxSwift OF PROJECT Pods WITH CONFIGURATION Debug ===
Check dependencies
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
[ +1 ms] Could not build the precompiled application for the device.
[ +2 ms] Error launching application on JSI iPhone X.
[ +3 ms] "flutter run" took 8,823ms.
#0 throwToolExit (package:flutter_tools/src/base/common.dart:28)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:351)
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:290)
#3 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:228)
#4 CommandRunner.runCommand (package:args/command_runner.dart:194)
#5 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:286)
#6 CommandRunner.run. (package:args/command_runner.dart:109)
#7 new Future.sync (dart:async/future.dart:222)
#8 CommandRunner.run (package:args/command_runner.dart:109)
#9 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:166)
#10 run. (package:flutter_tools/runner.dart:90)
#11 AppContext._run (package:flutter_tools/src/base/context.dart:76)
#12 AppContext.runInZone. (package:flutter_tools/src/base/context.dart:66)
#13 _rootRun (dart:async/zone.dart:1126)
#14 _CustomZone.run (dart:async/zone.dart:1023)
#15 runZoned (dart:async/zone.dart:1501)
#16 AppContext.runInZone (package:flutter_tools/src/base/context.dart:65)
#17 run (package:flutter_tools/runner.dart:61)
#18 main (package:flutter_tools/executable.dart:48)
#19 main (file:///Users/jackivers/Projects/Flutter/flutter/packages/flutter_tools/bin/flutter_tools.dart:16)
#20 _startIsolate. (dart:isolate-patch/dart:isolate/isolate_patch.dart:277)
#21 _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)`
Flutter Doctor:
`[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-US)
• Flutter version 0.1.5 at /Users/jackivers/Projects/Flutter/flutter
• Framework revision 3ea4d06340 (4 weeks ago), 2018-02-22 11:12:39 -0800
• Engine revision ead227f118
• Dart version 2.0.0-dev.28.0.flutter-0b4f01f759
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/jackivers/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.4.0
[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] VS Code (version 1.21.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Dart Code extension version 2.10.0
[✓] Connected devices (1 available)
• JSI iPhone X • 7abb1638e5f94117408869c9c5236c5acb0d7f0c • ios • iOS 11.2.6`
steps to reproduce:
build included example, run on ios, connect -> disconnect
seems you get your types wrong when calling convertToBleDeviceMessage
. this is the function:
+ (BleDataServiceMessage* _Nonnull) convertBleDataServiceMessage: (id _Nonnull) value {
BleDataServiceMessage* bleDataServiceMessage = [[BleDataServiceMessage alloc] init];
bleDataServiceMessage.id_p = ((NSNumber *) value[@"id"]).doubleValue;
bleDataServiceMessage.device = [[BleDataBleDeviceMessage alloc] init];
bleDataServiceMessage.device.id_p = value[@"deviceID"];
bleDataServiceMessage.uuid = value[@"uuid"];
bleDataServiceMessage.isPrimary = value[@"isPrimary"];
return bleDataServiceMessage;
}
connecting you handle it correclty:
but not so much when disconnecting:
I saw you have started some major refactorings for ios on the refactoring_ios
branch...are you still thinking about continuing your efforts? seems this has gone stale
I am using FlutterBleLib.instance.onDeviceConnectionChanged
to monitor the connection state of my devices, and it emits an event once a device gets disconnected, but once I reconnect it, then I don't get any event using iOS device. I haven't yet check it on Android.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.4 17E199, locale en-NL)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✗] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2018.1.5)
[✓] Connected devices (1 available)
! Doctor found issues in 2 categories.
MacBookProMiguel:DacHue user$ flutter doctor -v
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.4 17E199, locale en-NL)
• Flutter version 0.5.1 at /Users/user/flutter
• Framework revision c7ea3ca377 (9 weeks ago), 2018-05-29 21:07:33 +0200
• Engine revision 1ed25ca7b7
• Dart version 2.0.0-dev.58.0.flutter-f981f09760
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.4.1, Build version 9F2000
• ios-deploy 1.9.2
• CocoaPods version 1.5.3
[✗] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
[✓] IntelliJ IDEA Community Edition (version 2018.1.5)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 26.0.2
• Dart plugin version 181.4892.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.