Skip to content

Commit 5dbd076

Browse files
committed
Updated version to 0.0.7
Added last few missing public api documentation Added web as the only supported platform
1 parent f464128 commit 5dbd076

9 files changed

+46
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.0.7
2+
3+
* Added `getCharacteristics` to the bluetooth service to get all the characteristics.
4+
* Set target platform to web for [pub.dev](https://pub.dev/packages/flutter_web_bluetooth/) target platform list (it will still compile when used in non-native programs.)
5+
* Added documentation to the last few public interfaces
6+
17
## 0.0.6+2
28

39
* Fixed the behavior subject stream not returning the stored value causing some implementations to wait forever.

lib/src/bluetooth_characteristic_properties.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ part of flutter_web_bluetooth;
99
/// then it will throw a [NotSupportedError].
1010
///
1111
class BluetoothCharacteristicProperties {
12+
///
13+
/// A constructor for new characteristic properties.
14+
///
15+
/// **This should only be done by the library or if you're testing.**
16+
///
17+
/// To get an instance use [BluetoothCharacteristic.properties].
18+
///
1219
BluetoothCharacteristicProperties(this._properties);
1320

1421
final WebBluetoothCharacteristicProperties _properties;

lib/src/flutter_web_bluetooth_interface.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ part of flutter_web_bluetooth;
77
/// See: [FlutterWebBluetooth].
88
///
99
abstract class FlutterWebBluetoothInterface {
10+
///
11+
/// An interface for [FlutterWebBluetooth] to make sure that both the
12+
/// unsupported and web version have the same api.
13+
///
14+
/// See: [FlutterWebBluetooth].
15+
///
16+
FlutterWebBluetoothInterface();
17+
1018
///
1119
/// Get if the bluetooth api is available in this browser. This will only
1220
/// check if the api is in the `navigator`. Not if anything is available.

lib/src/flutter_web_bluetooth_unsupported.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import 'dart:typed_data';
1414
import 'package:flutter_web_bluetooth/js_web_bluetooth.dart';
1515
import 'package:meta/meta.dart';
1616

17-
import '../web_bluetooth_logger.dart';
1817
import '../shared/web_behavior_subject.dart';
18+
import '../web_bluetooth_logger.dart';
1919

2020
part 'bluetooth_characteristic.dart';
2121

@@ -61,6 +61,12 @@ class FlutterWebBluetooth extends FlutterWebBluetoothInterface {
6161

6262
static FlutterWebBluetooth? _instance;
6363

64+
///
65+
/// Get an instance of the library. There will always only be one instance.
66+
///
67+
/// **Note:** this is the unsupported variant that is exposed in io builds,
68+
/// check the web version where the functions actually work!
69+
///
6470
static FlutterWebBluetoothInterface get instance {
6571
return _instance ??= FlutterWebBluetooth._();
6672
}

lib/web/bluetooth.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@ class _NativeBluetooth {
112112
///
113113
@visibleForTesting
114114
class NativeBluetooth {
115+
///
116+
/// Create a new instance of [NativeBluetooth] with the default
117+
/// implementations for the methods that will call the actual methods
118+
/// on the navigator in the background.
119+
///
120+
/// Using the constructor can be used if you want to rest the native bluetooth
121+
/// implementation for testing using [setNativeBluetooth].
122+
///
123+
/// Otherwise the Fake library can be used to overwrite the methods for testing
124+
///
125+
@visibleForTesting
126+
NativeBluetooth();
127+
115128
///
116129
/// Should return a promise (which will be converted to a future using
117130
/// [JSUtils.promiseToFuture]) with a [bool] if bluetooth is available on

lib/web/web_bluetooth_remote_gatt_characteristic.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ part of js_web_bluetooth;
66
///
77
/// You can get a [WebBluetoothRemoteGATTCharacteristic] from
88
/// [WebBluetoothRemoteGATTService.getCharacteristic], and
9-
/// ignore: deprecated_member_use_from_same_package
109
/// [WebBluetoothRemoteGATTService.getCharacteristics].
1110
///
1211
/// See:
@@ -484,7 +483,6 @@ class WebBluetoothRemoteGATTCharacteristic {
484483
/// **This should only be done by the library or if you're testing.**
485484
///
486485
/// To get an instance use [WebBluetoothRemoteGATTService.getCharacteristic],
487-
/// ignore: deprecated_member_use_from_same_package
488486
/// and [WebBluetoothRemoteGATTService.getCharacteristics].
489487
///
490488
WebBluetoothRemoteGATTCharacteristic.fromJSObject(

lib/web/web_bluetooth_remote_gatt_service.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ class WebBluetoothRemoteGATTService {
120120
///
121121
/// See:
122122
///
123-
/// ignore: deprecated_member_use_from_same_package
124123
/// - [getCharacteristics]
125124
///
126125
/// - https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTService/getCharacteristic
@@ -136,14 +135,12 @@ class WebBluetoothRemoteGATTService {
136135
}
137136

138137
///
139-
/// ignore: deprecated_member_use_from_same_package
140138
/// Check to see if the [getCharacteristics] function exists on the js object.
141139
///
142140
/// It may not exist on some browsers.
143141
///
144142
/// See:
145143
///
146-
/// ignore: deprecated_member_use_from_same_package
147144
/// - [getCharacteristics]
148145
///
149146
bool hasGetCharacteristicsFunction() {

lib/web_bluetooth_logger.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Logger get webBluetoothLogger {
2828
}
2929

3030
///
31-
/// Overwrite the logger used so you can do decide where the log messages go.
31+
/// Overwrite the logger used so you can decide where the log messages go.
3232
///
3333
/// If you want to go back to the default logger at a later date then just call
3434
/// [initWebBluetoothLogger] to overwrite the user set logger for the default one.

pubspec.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
name: flutter_web_bluetooth
22
description: A library to use the web bluetooth api in your web project. Will play nice if used in IO projects.
3-
version: 0.0.6+2
3+
version: 0.0.7
44
homepage: https://github.com/jeroen1602/flutter_web_bluetooth/
55
repository: https://github.com/jeroen1602/flutter_web_bluetooth/
66
issue_tracker: https://github.com/jeroen1602/flutter_web_bluetooth/issues/
77

88
environment:
99
sdk: ">=2.12.0 <3.0.0"
1010

11+
platforms:
12+
web:
13+
1114
dependencies:
1215
js: '>=0.6.3 <0.7.0'
1316
meta: '>=1.3.0 <1.8.0'

0 commit comments

Comments
 (0)