|
@@ -31,22 +31,22 @@ class AmapLocation {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Future<void> startLocation({LocationOption options}) async {
|
|
Future<void> startLocation({LocationOption options}) async {
|
|
|
- if (_locationStreamController == null) {
|
|
|
|
|
- _locationStreamController =
|
|
|
|
|
- StreamController<LocationResultEntity>.broadcast();
|
|
|
|
|
- }
|
|
|
|
|
return await _channel.invokeMethod(
|
|
return await _channel.invokeMethod(
|
|
|
'startLocation', options?.toMap() ?? LocationOption().toMap());
|
|
'startLocation', options?.toMap() ?? LocationOption().toMap());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Future<void> disposed() async {
|
|
|
|
|
- if (!_locationStreamController.isClosed) {
|
|
|
|
|
- await _locationStreamController.close();
|
|
|
|
|
- _locationStreamController=null;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Future<void> closeLocation() async {
|
|
|
return await _channel.invokeMethod("closeLocation");
|
|
return await _channel.invokeMethod("closeLocation");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Future<void> disposed() async {
|
|
|
|
|
+ // if (!_locationStreamController.isClosed) {
|
|
|
|
|
+ // await _locationStreamController.close();
|
|
|
|
|
+ // _locationStreamController=null;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // return await _channel.invokeMethod("closeLocation");
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
Future<void> platformCallHandler(MethodCall call) async {
|
|
Future<void> platformCallHandler(MethodCall call) async {
|
|
|
try {
|
|
try {
|
|
|
if (call.method == "location") {
|
|
if (call.method == "location") {
|