You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
45 lines
1.2 KiB
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<void> setApiKey({String? iosKey, String? androidKey}) async {
|
|
await methodChannel.invokeMethod('setApiKey', {
|
|
"iosKey": iosKey,
|
|
"androidKey": androidKey,
|
|
});
|
|
}
|
|
|
|
@override
|
|
Future<void> initLocation() async {
|
|
return await methodChannel.invokeMethod('initLocation');
|
|
}
|
|
|
|
@override
|
|
Future<void> startLocation() async {
|
|
return await methodChannel.invokeMethod('startLocation');
|
|
}
|
|
|
|
@override
|
|
Stream<dynamic> locationStream() {
|
|
return eventChannel.receiveBroadcastStream();
|
|
}
|
|
|
|
@override
|
|
Future<void> stopLocation() async {
|
|
await methodChannel.invokeMethod('stopLocation');
|
|
}
|
|
|
|
@override
|
|
Future<void> dispose() async {
|
|
await methodChannel.invokeMethod('dispose');
|
|
}
|
|
}
|
|
|