Skip to content

Commit dc7f8e6

Browse files
committed
Changed data display to hex array.
1 parent 757c57f commit dc7f8e6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

example/lib/widgets.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,19 @@ class ScanResultTile extends StatelessWidget {
5050
);
5151
}
5252

53+
String getNiceHexArray(List<int> bytes) {
54+
return '[${bytes.map((i) => i.toRadixString(16).padLeft(2, '0')).join(', ')}]'
55+
.toUpperCase();
56+
}
57+
5358
String getNiceManufacturerData(Map<int, List<int>> data) {
5459
if (data.isEmpty) {
5560
return null;
5661
}
5762
List<String> res = [];
5863
data.forEach((id, bytes) {
59-
res.add('${id.toRadixString(16).toUpperCase()}: $bytes');
64+
res.add(
65+
'${id.toRadixString(16).toUpperCase()}: ${getNiceHexArray(bytes)}');
6066
});
6167
return res.join(', ');
6268
}
@@ -67,7 +73,7 @@ class ScanResultTile extends StatelessWidget {
6773
}
6874
List<String> res = [];
6975
data.forEach((id, bytes) {
70-
res.add('$id: $bytes');
76+
res.add('$id: ${getNiceHexArray(bytes)}');
7177
});
7278
return res.join(', ');
7379
}
@@ -98,7 +104,7 @@ class ScanResultTile extends StatelessWidget {
98104
context,
99105
'Service UUIDs',
100106
(result.advertisementData.serviceUuids.isNotEmpty)
101-
? result.advertisementData.serviceUuids.join(', ')
107+
? result.advertisementData.serviceUuids.join(', ').toUpperCase()
102108
: 'N/A'),
103109
_buildAdvRow(context, 'Service Data',
104110
getNiceServiceData(result.advertisementData.serviceData) ?? 'N/A'),

0 commit comments

Comments
 (0)