$ show oguzhnatly/flutter_carplay
This repository is a Flutter plugin that bridges Flutter applications with Apple CarPlay and Android Auto in-car infotainment systems. It provides a Dart API to construct native vehicle-optimized UI templates (lists, grids, tab bars, alerts, search, etc.) and manage navigation stacks on both platforms. The architecture is a classic Flutter plugin pattern: Dart models serialize to JSON, which is passed via method channels to native iOS (Swift) and Android (Kotlin) implementations that render the corresponding native CarPlay/Android Auto templates. Event channels handle user interactions (list item selection, alert actions, connection changes) back to Dart. The plugin includes a sophisticated SVG rasterization utility that converts Flutter asset SVGs to PNG bytes for native consumption, since native platforms cannot render SVG directly. It also provides image loading with caching and tinting on both platforms. The example app demonstrates full setup and usage for both iOS and Android, including scene delegate configuration and Android Auto service registration. External dependencies include the Flutter SDK, flutter_svg for rasterization, and native frameworks (CarPlay.framework on iOS, Car App API on Android).
The LLM identified 4 files worth highlighting for reuse:
Recursive payload walker that converts Flutter asset SVGs to PNG bytes for native consumption. Implements caching and in-flight request sharing to avoid duplicate work. Configurable raster size. Demonstrates non-obvious handling of SVG rendering in a cross-platform plugin where native platforms cannot render SVG directly. Self-contained and extractable.
Extensions on UIImage providing async loading from assets, files, and network URLs with caching, tinting, and placeholder support. Used by CarPlay templates to display icons. Reusable pattern for any iOS CarPlay app needing image loading with caching.
Utility functions for resolving car icons from Android assets, file paths, or network URLs with tinting and caching. Demonstrates Android Auto icon loading pattern that can be reused in other Android Auto plugins or apps.
A coroutine-based utility for safely handling method channel results on Android. Wraps async operations with proper error propagation and result callback. Reduces boilerplate in Flutter plugin Android implementations. Reusable pattern for any Flutter plugin's Android side.