push static method
Adds a template to the navigation hierarchy and displays it.
-
template is to add to the navigation hierarchy. Must be one of the type: CPGridTemplate or CPListTemplate
CPInformationTemplatCPPointOfInterestTemplate If not, it will throw an TypeError -
If animated is true, CarPlay animates the transition between templates.
Implementation
static Future<bool> push({
required CPTemplate template,
bool animated = true,
}) async {
if (template is CPGridTemplate ||
template is CPListTemplate ||
template is CPInformationTemplate ||
template is CPPointOfInterestTemplate) {
final bool? isCompleted = await _carPlayController.flutterToNativeModule(
FCPChannelTypes.pushTemplate, <String, dynamic>{
'template': template.toJson(),
'animated': animated,
'runtimeType': 'F${template.runtimeType}',
});
if (isCompleted == true) {
_carPlayController.addTemplateToHistory(template);
}
return isCompleted ?? false;
} else {
throw TypeError();
}
}