showAlert static method
It will present CPAlertTemplate modally.
- template is to present modally.
- If animated is true, CarPlay animates the presentation of the template.
!
CarPlay can only present one modal template at a time.
Implementation
static void showAlert({
required CPAlertTemplate template,
bool animated = true,
}) {
_carPlayController.methodChannel.invokeMethod(
CPEnumUtils.stringFromEnum(FCPChannelTypes.setAlert.toString()),
<String, dynamic>{
'rootTemplate': template.toJson(),
'animated': animated,
'onPresent': template.onPresent != null ? true : false,
}).then((value) {
if (value) {
FlutterCarPlayController.currentPresentTemplate = template;
}
});
}