FlutterCarplay class

An object in order to integrate Apple CarPlay in navigation and manage all user interface elements appearing on your screens displayed on the CarPlay screen.

Using CarPlay, you can display content from your app on a customized user interface that is generated and hosted by the system itself. Control over UI elements, such as touch target size, font size and color, highlights, and so on.

Useful Links:

Constructors

FlutterCarplay()
Creates an FlutterCarplay and starts the connection.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListenerOnConnectionChange(dynamic onCarplayConnectionChange(ConnectionStatusTypes status)) → void
Callback function will be fired when CarPlay connection status is changed. For example, when CarPlay is connected to the device, in the background state, or completely disconnected.
closeConnection() → void
A function that will disconnect all event listeners from CarPlay. The action will be irrevocable, and a new FlutterCarplay controller must be created after this, otherwise CarPlay will be unusable.
forceUpdateRootTemplate() → Future<void>
It will set the current root template again.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pauseConnection() → void
A function that will pause the all active event listeners from CarPlay.
removeListenerOnConnectionChange() → void
Removes the callback function that has been set before in order to listen on CarPlay connection status changed.
resumeConnection() → void
A function that will resume the paused all event listeners from CarPlay.
toString() → String
A string representation of this object.
inherited
updateInformationTemplateActions({required String elementId, required List<CPTextButton> actions}) → Future<void>
It will update the actions of the CPInformationTemplate which has the given elementId.
updateInformationTemplateItems({required String elementId, required List<CPInformationItem> items}) → Future<void>
It will update the information items of the CPInformationTemplate which has the given elementId.
updateListTemplateSections({required String elementId, required List<CPListSection> sections}) → Future<void>
It will update the sections of the CPListTemplate which has the given elementId.
updateTabBarTemplates({required String elementId, required List<CPTemplate> templates}) → Future<void>
It will update the templates of the CPTabBarTemplate which has the given elementId. Supported template types: CPListTemplate, CPPointOfInterestTemplate, CPGridTemplate, CPInformationTemplate

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

connectionStatus → String
Current CarPlay connection status. It will return one of ConnectionStatusTypes as String.
no setter
debugImageSizing ↔ bool
Logs the values that drive CarPlay image sizing — the car's displayScale, CPListItem.maximumImageSize, and each image's pixel dimensions before and after rendering — to the iOS system log.
getter/setter pair
iconSize ↔ AutoImageSize
Default display size for every CarPlay icon that does not set its own imageSize.
getter/setter pair
rootTemplate → dynamic
Getter for current root template. Return one of type CPTabBarTemplate, CPGridTemplate, CPListTemplate
no setter
svgRasterSize ↔ int
The size (in logical pixels, square) used when rasterizing Flutter asset SVGs referenced by image fields (e.g. CPListItem.image, CPGridButton.image, CPPoi.image) before they are sent to the native side. Defaults to defaultSvgRasterSize (264).
getter/setter pair

Static Methods

activateVoiceControlState({required String elementId, required String identifier}) → Future<bool>
Activates a state only on the currently presented voice template. CarPlay rate limits state changes. True means the host's active identifier matches the requested identifier immediately after activation.
pop({bool animated = true, int count = 1}) → Future<bool>
Removes the top-most template from the navigation hierarchy.
popModal({bool animated = true}) → Future<bool>
Dismisses the current modal, including voice control, or cancels its loading. A failed dismissal of a presented modal preserves its callbacks.
popToRoot({bool animated = true}) → Future<bool>
Removes all of the templates from the navigation hierarchy except the root template. If animated is true, CarPlay animates the presentation of the template.
push({required CPTemplate template, bool animated = true}) → Future<bool>
Adds a template to the navigation hierarchy and displays it.
setRootTemplate({required CPTemplate rootTemplate, bool animated = true}) → Future<void>
Sets the root template of the navigation hierarchy. If a navigation hierarchy already exists, CarPlay replaces the entire hierarchy.
showActionSheet({required CPActionSheetTemplate template, bool animated = true}) → Future<void>
Presents an action sheet if no modal is already open or being prepared.
showAlert({required CPAlertTemplate template, bool animated = true}) → Future<void>
It will present CPAlertTemplate modally.
showSharedNowPlaying({bool animated = true}) → Future<bool>
Navigate to the shared instance of the NowPlaying Template
showVoiceControl({required CPVoiceControlTemplate template, bool animated = true}) → Future<bool>
Presents a voice indicator modally and returns the native presentation result.