<?code-excerpt path-base="excerpts/packages/google_matter_flutter_example"?>
Flutter plugin for getting implementing Google's Matter SDKs on Android Supports only Android for now.
Please note that this plugin is still under development, and many APIs are not be available yet. The library is also unstable and crashed when unhandled devices are commissioned. If you can help with any of the above, please feel free to contribute to the project.
google_matter_flutter
as a dependency in your pubspec.yaml file.Inside Activity tag:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.home.matter.ACTION_COMMISSION_DEVICE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Inside Application tag:
<service
android:name="com.google.google_matter_flutter.google_matter_flutter.AppCommissioningService"
android:exported="true" />
final GoogleMatterFlutter _googleMatterFlutterPlugin = GoogleMatterFlutter();
// Commission a Matter device
final MatterDevice? device = await _googleMatterFlutterPlugin.commissionDevice();
// Get device events
if (device != null) {
device.listenToEvents().listen((event) {
print(event);
});
}