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
CPInformationTemplat
CPPointOfInterestTemplate If not, it will throw an TypeError -
If animated is true, CarPlay animates the transition between templates.
Implementation
static Future<bool> push({
required dynamic template,
bool animated = true,
}) async {
if (template.runtimeType == CPGridTemplate ||
template.runtimeType == CPListTemplate ||
template.runtimeType == CPInformationTemplate ||
template.runtimeType == CPPointOfInterestTemplate
) {
bool isCompleted = await _carPlayController
.reactToNativeModule(FCPChannelTypes.pushTemplate, <String, dynamic>{
"template": template.toJson(),
"animated": animated,
"runtimeType": "F" + template.runtimeType.toString(),
});
if (isCompleted) {
_carPlayController.addTemplateToHistory(template);
}
return isCompleted;
} else {
throw TypeError();
}
}