initAutomotive method
Initialize the map with the given style URL and VietMap API key.
Implementation
@override
Future<bool?> initAutomotive(
{required String styleUrl, required String vietMapAPIKey}) async {
final initDataJson = <String, dynamic>{
'styleUrl': styleUrl,
'vietMapAPIKey': vietMapAPIKey,
};
if (Platform.isIOS) {
final rootTemplate = CPMapTemplate(
hidesButtonsWithNavigationBar: true,
styleUrl: styleUrl,
mapButtons: [
CPMapButton(
onClickEvent: OnClickEvents.showPanningInterface,
),
CPMapButton(
onClickEvent: OnClickEvents.recenterMapView,
),
CPMapButton(
onClickEvent: OnClickEvents.zoomInMapView,
),
CPMapButton(
onClickEvent: OnClickEvents.zoomOutMapView,
),
],
trailingNavigationBarButtons: [
CPBarButton(
onClickEvent: OnClickEvents.dismissPanningInterface,
title: 'Close',
),
],
);
initDataJson['rootTemplate'] = rootTemplate.toJson();
}
final responseMessage = await methodChannel.invokeMethod<bool>(
Events.initAutomotive,
initDataJson,
);
return responseMessage;
}