fix: address analysis issues - remove unused import, fix deprecated APIs, update test

This commit is contained in:
fiatcode 2026-04-30 11:40:56 +07:00
parent 85249acc84
commit 07bae466cf
No known key found for this signature in database
32 changed files with 1550 additions and 75 deletions

View file

@ -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!;
}
}