google_matter_flutter 0.2.0
google_matter_flutter: ^0.2.0 copied to clipboard
A Flutter plugin for commissioning, discovering and controlling Matter smart home devices on Android via Google's Matter SDK, with a capability-based Dart API.
0.2.0 #
- Added
GoogleMatterFlutter.shareDevice(), allowing an already-commissioned device to be shared with another ecosystem/app by opening a new commissioning window via Google'sShareDeviceAPI (contributed by Marco Lettieri, microbees.com; re-integrated on top of the singletonChipClientand nullablemethodCallResultintroduced below). - BREAKING: Removed the direct
shared_preferencesdependency from this plugin's ownpubspec.yaml. If your app relied on gettingshared_preferencestransitively through this plugin without declaring it yourself, add it directly to your ownpubspec.yaml. - Removed the unused
hilt-androiddependency and its inert@Inject/@Singleton/@AndroidEntryPoint/@ApplicationContextannotations (the Hilt Gradle plugin/annotation processor was never actually applied, so they did nothing but add ~2MB of dead weight and mislead readers into thinking a real DI graph was wired up). - Fixed
ChipClient(and transitivelyAppCommissioningServiceandGoogleMatter'sgetDeviceData()/discoverDevice()/performClusterAction()) to share one process-wideChipDeviceControllerinstance via a manual singleton (ChipClient.getInstance()) instead of constructing a brand new one - reloading the native CHIP JNI library and recreating the BLE manager/mDNS resolver/browser - on every single call. This was a latent performance/resource leak that got worse the more a device's state was polled. - Replaced deprecated
String.toLowerCase()calls withlowercase()inGoogleMatter.kt. - Cleaned up the bundled example app: converted
Key? keyconstructor to a super parameter, and documented/silenced the intentionallistenToEvents()deprecation warning instead of leaving an unexplained analyzer hit. - Clarified the package
descriptioninpubspec.yamlfor the pub.dev listing. - Replaced every raw
print()/println()call on the native Android side with a smallMatterLoghelper that only logs (viaandroid.util.Log, taggedGoogleMatterFlutter) when this module is built withBuildConfig.DEBUG == true, so apps depending on this plugin no longer get unconditional stdout/logcat spam in release builds. - Removed a leftover raw
print()from the example app in favor ofdebugPrint(). - Massively expanded device/cluster support, replacing the original single-device,
name-sniffing-based integration with a spec-driven capability model:
- Added
MatterDevice.discoverEndpoints(), backed by a new nativediscoverDevice()method channel call, which queries the device's actual endpoints, device types and server clusters (via the existingClustersHelper.fetchDeviceMatterInfo) instead of guessing behavior from the device's name string. - Added
MatterEndpointandMatterCapability(on/off, level control, color control, door lock, window covering, thermostat, and five read-only sensor types) to represent what a device supports, derived directly from its advertised cluster IDs per the Matter Application Cluster spec. - Added native cluster helpers (
ClustersHelper.kt) and a genericperformClusterAction()method channel dispatch (GoogleMatter.kt/GoogleMatterFlutterPlugin.kt) covering:LevelControlCluster(get/set brightness),ColorControlCluster(hue/saturation, color temperature),DoorLockCluster(lock/unlock/state),WindowCoveringCluster(open/close/lift position),ThermostatCluster(local temperature, heating/cooling setpoints), and read-onlyTemperatureMeasurementCluster,RelativeHumidityMeasurementCluster,IlluminanceMeasurementCluster,PressureMeasurementCluster,FlowMeasurementCluster. - Added corresponding typed Dart methods on
MatterDevice(getOnOff/toggleOnOff,getLevel/setLevel,setHueAndSaturation/setColorTemperature,lockDoor/unlockDoor/getLockState,openWindowCovering/closeWindowCovering/setWindowCoveringLiftPosition, thermostat setpoint getters/setters, and sensor getters). - Expanded
MatterConstants.DeviceTypesMap(native) with ~50 common Matter device type IDs (lights, plugs, sensors, locks, window coverings, thermostats, appliances, etc), sourced from the upstreamconnectedhomeipMatter Device Library spec.
- Added
- Fixed
GoogleMatterFlutter.commissionDevice()/getDeviceData()to go throughGoogleMatterFlutterPlatform.instance(the standard plugin-platform-interface pattern) instead of hardcodingMethodChannelGoogleMatterFlutter()directly — this was a latent bug that broke test/platform mocking for those two methods. - The original
getLastStatus()/listenToEvents()boolean-polling API is preserved and marked@Deprecated(not removed) for backwards compatibility with existing integrations. - Removed a leftover reference to an internal/unrelated project name from the workspace root README; genericized the wording instead.
- Added unit tests for capability derivation, endpoint-based action dispatch and method channel argument marshalling.
0.1.0 #
- BREAKING:
minSdkVersionraised from16to27(Android 8.1+), required by the newer Matter/Home Mobile SDK APIs. Apps targeting older devices must bump their ownminSdkVersionbefore taking this dependency. - BREAKING: Android toolchain raised to AGP
8.2.0, Kotlin1.9.20, Java/Kotlin bytecode target17, andcompileSdk 34(from AGP7.1.2, Kotlin1.6.10, Java1.8,compileSdk 31). Consuming apps need a compatible Gradle/AGP/Kotlin setup. - Replaced the manually-bundled
third_party/connectedhomeipnative binaries (CHIPController.jar,SetupPayloadParser.jar, per-ABI.solibs) with Google's officially publishedcom.google.matter:matter-android-demo-sdk:1.0Maven artifact, following the 2024 Google Home Sample App for Matter (sample-apps-for-matter-android, v2.0.0). Consumers no longer need to manually download/copy any native libraries. - Updated
ClustersHelperfor renamed/changed CHIP APIs in the newer Matter SDK:ChipClusters.BasicCluster->ChipClusters.BasicInformationCluster, andChipStructs.DescriptorClusterDeviceTypeStruct.type->.deviceType. - Added error handling (
CommissioningService.CommissioningError) toAppCommissioningServicewhen PASE/commissioning fails, instead of silently swallowing it. - Bumped
play-services-base18.1.0 -> 18.2.0,hilt-android2.41 -> 2.48.1,shared_preferences^2.0.17 -> ^2.3.2,plugin_platform_interface^2.1.3 -> ^2.1.7. - Removed unused
androidx.datastore/protobuf-javalitedependencies (dead weight carried over from the original codelab, never actually used by this plugin). - Added AGP-8-required
namespacetobuild.gradleand removed the now-deprecatedpackageattribute fromAndroidManifest.xml. - Verified the plugin's bundled
example/app and the standalonegoogle_matter_flutter_exampleapp both build a debug APK successfully end-to-end with this new stack.
0.0.1 #
- Initial release.
- Integrate google Matter lib following the codelab from Google