File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -84,17 +84,24 @@ class FlutterBlue {
84
84
// Emit to isScanning
85
85
_isScanning.add (true );
86
86
87
- // Clear scan results list
88
- _scanResults.add (< ScanResult > []);
89
-
90
- await _channel.invokeMethod ('startScan' , settings.writeToBuffer ());
91
-
92
87
final killStreams = < Stream > [];
93
88
killStreams.add (_stopScanPill);
94
89
if (timeout != null ) {
95
90
killStreams.add (Observable .timer (null , timeout));
96
91
}
97
92
93
+ // Clear scan results list
94
+ _scanResults.add (< ScanResult > []);
95
+
96
+ try {
97
+ await _channel.invokeMethod ('startScan' , settings.writeToBuffer ());
98
+ } catch (e) {
99
+ print ('Error starting scan.' );
100
+ _stopScanPill.add (null );
101
+ _isScanning.add (false );
102
+ throw e;
103
+ }
104
+
98
105
yield * Observable (FlutterBlue .instance._methodStream
99
106
.where ((m) => m.method == "ScanResult" )
100
107
.map ((m) => m.arguments))
You can’t perform that action at this time.
0 commit comments