From e66f1ed6a30623187feb81e771cff3c0bf922ae2 Mon Sep 17 00:00:00 2001 From: Malte2036 Date: Fri, 3 Nov 2023 11:43:27 +0100 Subject: [PATCH] :sparkles: Upgrade example to v1.0.0 --- README.md | 2 +- example/lib/main.dart | 4 ++-- example/lib/widgets.dart | 21 ++++++++++--------- example/pubspec.lock | 44 +++++++++++++--------------------------- example/pubspec.yaml | 2 +- 5 files changed, 29 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 1b2802e..137798f 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ After completing the `flutter_blue_plus` setup, you can add the following depend ```yaml dependencies: - flutter_ftms: 0.9.0 + flutter_ftms: 1.0.0 ``` Then, run `flutter pub get` to install the package. diff --git a/example/lib/main.dart b/example/lib/main.dart index b897e87..05bc198 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -66,7 +66,7 @@ class _ScanPageState extends State { initialData: const [], builder: (c, snapshot) => scanResultsToWidget( (snapshot.data ?? []) - .where((element) => element.device.name.isNotEmpty) + .where((element) => element.device.platformName.isNotEmpty) .toList(), context), ), @@ -133,7 +133,7 @@ class _FTMSPageState extends State { child: Scaffold( appBar: AppBar( title: Text( - '${widget.ftmsDevice.name} (${FTMS.getDeviceDataTypeWithoutConnecting(widget.ftmsDevice)})'), + '${widget.ftmsDevice.platformName} (${FTMS.getDeviceDataTypeWithoutConnecting(widget.ftmsDevice)})'), bottom: const TabBar( tabs: [ Tab( diff --git a/example/lib/widgets.dart b/example/lib/widgets.dart index 12b2f5e..7398e31 100644 --- a/example/lib/widgets.dart +++ b/example/lib/widgets.dart @@ -30,10 +30,12 @@ Widget scanResultsToWidget(List data, BuildContext context) { initialData: false, builder: (c, snapshot) { return Text( - d.device.name.isEmpty ? "(unknown device)" : d.device.name, + d.device.platformName.isEmpty + ? "(unknown device)" + : d.device.platformName, ); }), - subtitle: Text(d.device.id.id), + subtitle: Text(d.device.remoteId.str), leading: SizedBox( width: 40, child: Center( @@ -49,35 +51,34 @@ Widget scanResultsToWidget(List data, BuildContext context) { Widget getButtonForBluetoothDevice( BluetoothDevice device, BuildContext context) { - return StreamBuilder( - stream: device.state, + return StreamBuilder( + stream: device.connectionState, builder: (c, snapshot) { if (!snapshot.hasData) { return const Text("..."); } var deviceState = snapshot.data!; switch (deviceState) { - case BluetoothDeviceState.disconnected: + case BluetoothConnectionState.disconnected: return ElevatedButton( child: const Text("Connect"), onPressed: () async { final snackBar = SnackBar( - content: Text('Connecting to ${device.name}...'), + content: Text('Connecting to ${device.platformName}...'), duration: const Duration(seconds: 2), ); ScaffoldMessenger.of(context).showSnackBar(snackBar); await FTMS.connectToFTMSDevice(device); - device.state.listen((state) async { - if (state == BluetoothDeviceState.disconnected || - state == BluetoothDeviceState.disconnecting) { + device.connectionState.listen((state) async { + if (state == BluetoothConnectionState.disconnected) { ftmsBloc.ftmsDeviceDataControllerSink.add(null); return; } }); }, ); - case BluetoothDeviceState.connected: + case BluetoothConnectionState.connected: return SizedBox( width: 250, child: Wrap( diff --git a/example/pubspec.lock b/example/pubspec.lock index 6bddc72..b4e67b6 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -57,14 +57,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" - url: "https://pub.dev" - source: hosted - version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -74,18 +66,18 @@ packages: dependency: transitive description: name: flutter_blue_plus - sha256: a977e90b7f9dcece90a95a287f8843e3b9028a61199c41bc279832c096d31d43 + sha256: "2df6091f9f3f3dd13dba39e681e9591eb2c243c8aecebcbb737e5bc54ca77521" url: "https://pub.dev" source: hosted - version: "1.5.2" + version: "1.20.8" flutter_ftms: dependency: "direct main" description: name: flutter_ftms - sha256: "9272a099ac61eea0921acc6172ff2f3a238520e87c1e92ba73df0d9ee9c0c29b" + sha256: "2e8c57cfee42a21e88e991d01c37f8ab3f1dee78d87e691920eefd0e37562e35" url: "https://pub.dev" source: hosted - version: "0.8.1" + version: "1.0.0" flutter_lints: dependency: "direct dev" description: @@ -151,42 +143,42 @@ packages: dependency: transitive description: name: permission_handler - sha256: "33c6a1253d1f95fd06fa74b65b7ba907ae9811f9d5c1d3150e51417d04b8d6a8" + sha256: "284a66179cabdf942f838543e10413246f06424d960c92ba95c84439154fcac8" url: "https://pub.dev" source: hosted - version: "10.2.0" + version: "11.0.1" permission_handler_android: dependency: transitive description: name: permission_handler_android - sha256: d8cc6a62ded6d0f49c6eac337e080b066ee3bce4d405bd9439a61e1f1927bfe8 + sha256: f9fddd3b46109bd69ff3f9efa5006d2d309b7aec0f3c1c5637a60a2d5659e76e url: "https://pub.dev" source: hosted - version: "10.2.1" + version: "11.1.0" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: ee96ac32f5a8e6f80756e25b25b9f8e535816c8e6665a96b6d70681f8c4f7e85 + sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5" url: "https://pub.dev" source: hosted - version: "9.0.8" + version: "9.1.4" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - sha256: "68abbc472002b5e6dfce47fe9898c6b7d8328d58b5d2524f75e277c07a97eb84" + sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4" url: "https://pub.dev" source: hosted - version: "3.9.0" + version: "3.12.0" permission_handler_windows: dependency: transitive description: name: permission_handler_windows - sha256: f67cab14b4328574938ecea2db3475dad7af7ead6afab6338772c5f88963e38b + sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098 url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "0.1.3" plugin_platform_interface: dependency: transitive description: @@ -195,14 +187,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - protobuf: - dependency: transitive - description: - name: protobuf - sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08" - url: "https://pub.dev" - source: hosted - version: "2.1.0" sky_engine: dependency: transitive description: flutter diff --git a/example/pubspec.yaml b/example/pubspec.yaml index b6434cc..259b5c4 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -28,7 +28,7 @@ environment: # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: - flutter_ftms: "^0.8.1" + flutter_ftms: "^1.0.0" flutter: sdk: flutter