From 851342c086a4fb31a64c04d7a2d2defa1192b718 Mon Sep 17 00:00:00 2001 From: davidxiao1985 Date: Fri, 1 Apr 2022 15:03:35 +0800 Subject: [PATCH] Update flutter_blue.dart need to find the newest ScanResult, have to put the new data at the tail to easy find it --- lib/src/flutter_blue.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/src/flutter_blue.dart b/lib/src/flutter_blue.dart index 6d2f76e9..f0979cae 100644 --- a/lib/src/flutter_blue.dart +++ b/lib/src/flutter_blue.dart @@ -134,10 +134,9 @@ class FlutterBlue { final list = _scanResults.value ?? []; int index = list.indexOf(result); if (index != -1) { - list[index] = result; - } else { - list.add(result); + list.removeAt(index); } + list.add(result); _scanResults.add(list); return result; });