push static method

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

Adds a template to the navigation hierarchy and displays it.

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