Trim spaces in UUIDs

This commit is contained in:
Foti Dim
2024-07-15 11:53:00 +02:00
parent efaa72acbd
commit c0c678c735
4 changed files with 12 additions and 1 deletions
+3
View File
@@ -1,3 +1,6 @@
## 0.11.1
* Trim spaces in UUIDs
## 0.11.0
* Unify UUID format across all platforms, 128-bit lowercase
* Add BleUuidParser utility methods for UUID parsing
+1
View File
@@ -4,6 +4,7 @@ class BleUuidParser {
/// Parse a string to a valid 128-bit UUID.
/// Throws `FormatException` if the string does not hold a valid UUID format.
static String string(String uuid) {
uuid = uuid.trim();
if (uuid.length < 4) {
throw const FormatException('Invalid UUID');
}
+1 -1
View File
@@ -1,6 +1,6 @@
name: universal_ble
description: A cross-platform (Android/iOS/macOS/Windows/Linux/Web) Bluetooth Low Energy (BLE) plugin for Flutter
version: 0.11.0
version: 0.11.1
homepage: https://navideck.com
repository: https://github.com/Navideck/universal_ble
issue_tracker: https://github.com/Navideck/universal_ble/issues
+7
View File
@@ -59,6 +59,13 @@ void main() {
equals('0000180a-0000-1000-8000-00805f9b34fb'),
);
});
test('128-bit UUID with trailing space', () {
expect(
BleUuidParser.string('0000180a-0000-1000-8000-00805f9b34fb '),
equals('0000180a-0000-1000-8000-00805f9b34fb'),
);
});
});
group('Fails', () {
test('Invalid UUID length is less than 4', () {