push static method

Future<bool> push({
  1. required dynamic template,
  2. bool animated = true,
})

Adds a template to the navigation hierarchy and displays it.

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();
  }
}