import 'package:flutter/services.dart'; class DriverLocationServiceManager { static const MethodChannel _channel = MethodChannel('com.camelsoft.wanisdriver/DriverLocationService'); static Future startService({required String authToken, required int driverId}) async { try { await _channel.invokeMethod('startDriverLocationService', { 'authToken': authToken, 'driverId': driverId, }); } on PlatformException catch (e) { print("Failed to start DriverLocationService: ${e.message}"); } } static Future stopService() async { try { await _channel.invokeMethod('stopDriverLocationService'); } on PlatformException catch (e) { print("Failed to stop DriverLocationService: ${e.message}"); } } static Future isServiceRunning() async { try { final bool isRunning = await _channel.invokeMethod('isDriverLocationServiceRunning'); return isRunning; } on PlatformException catch (e) { print("Failed to check DriverLocationService status: ${e.message}"); return false; } } }