fix: address analysis issues - remove unused import, fix deprecated APIs, update test
This commit is contained in:
parent
85249acc84
commit
07bae466cf
32 changed files with 1550 additions and 75 deletions
|
|
@ -2,10 +2,12 @@ import 'dart:async';
|
|||
import 'package:flutter/services.dart';
|
||||
|
||||
class LocationBridge {
|
||||
static const MethodChannel _methodChannel =
|
||||
MethodChannel('com.traccar.client/tracking');
|
||||
static const EventChannel _eventChannel =
|
||||
EventChannel('com.traccar.client/location_updates');
|
||||
static const MethodChannel _methodChannel = MethodChannel(
|
||||
'com.traccar.client/tracking',
|
||||
);
|
||||
static const EventChannel _eventChannel = EventChannel(
|
||||
'com.traccar.client/location_updates',
|
||||
);
|
||||
|
||||
static Stream<Map<String, dynamic>>? _locationStream;
|
||||
|
||||
|
|
@ -31,8 +33,10 @@ class LocationBridge {
|
|||
|
||||
static Future<bool> updateConfig(Map<String, dynamic> config) async {
|
||||
try {
|
||||
final result =
|
||||
await _methodChannel.invokeMethod<bool>('updateConfig', config);
|
||||
final result = await _methodChannel.invokeMethod<bool>(
|
||||
'updateConfig',
|
||||
config,
|
||||
);
|
||||
return result ?? false;
|
||||
} on PlatformException catch (e) {
|
||||
print('Failed to update config: ${e.message}');
|
||||
|
|
@ -51,9 +55,9 @@ class LocationBridge {
|
|||
}
|
||||
|
||||
static Stream<Map<String, dynamic>> get locationUpdates {
|
||||
_locationStream ??= _eventChannel
|
||||
.receiveBroadcastStream()
|
||||
.map((event) => Map<String, dynamic>.from(event as Map));
|
||||
_locationStream ??= _eventChannel.receiveBroadcastStream().map(
|
||||
(event) => Map<String, dynamic>.from(event as Map),
|
||||
);
|
||||
return _locationStream!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue