launchMapActivity method
Launches a map activity on the platform.
This method sends a request to the platform side to initiate a map activity. It uses the MethodChannel to communicate with the platform, passing parameters to customize the map activity.
The parameters include:
setEnablePropertyListSelection: A boolean that enables or disables property list selection.setShowPropertyListOnMapLaunch: A boolean that determines whether to show the property list when the map activity is launched.
If an error occurs while invoking the method, it is caught and printed using debugPrint. The exception is then rethrown to be handled by the caller.
Example usage:
final mapsted = MethodChannelMapstedFlutter();
try {
await mapsted.launchMapActivity();
} catch (e) {
// Handle the error
}
Implementation
@override
Future<void> launchMapActivity() async {
try {
await _methodChannel.invokeMethod('launchMapActivity', {
'setEnablePropertyListSelection': true,
'setShowPropertyListOnMapLaunch': true,
});
} on PlatformException catch (e) {
debugPrint('Error launching map activity: ${e.message}');
rethrow;
}
}