import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'amap_flutter_platform_interface.dart'; /// An implementation of [AmapFlutterPlatform] that uses method channels. class MethodChannelAmapFlutter extends AmapFlutterPlatform { /// The method channel used to interact with the native platform. @visibleForTesting final methodChannel = const MethodChannel('amap_flutter'); final eventChannel = const EventChannel('amap_flutter/events'); @override Future setApiKey({String? iosKey, String? androidKey}) async { await methodChannel.invokeMethod('setApiKey', { "iosKey": iosKey, "androidKey": androidKey, }); } @override Future initLocation() async { return await methodChannel.invokeMethod('initLocation'); } @override Future startLocation() async { return await methodChannel.invokeMethod('startLocation'); } @override Stream locationStream() { return eventChannel.receiveBroadcastStream(); } @override Future stopLocation() async { await methodChannel.invokeMethod('stopLocation'); } @override Future dispose() async { await methodChannel.invokeMethod('dispose'); } }