flutter_matter

A beautiful and low-level Matter plugin for Flutter on Android and iOS.

flutter_matter demo


✨ Features

  • Provisioning
    Supports both BLE commissioning and on-network commissioning.
    On Android, you can also provide your own GATT implementation to send Matter commissioning data.

  • Thread network support
    Pass a Thread Active Operational Dataset using:

    NetworkCredentials.thread(ThreadCredentials(...))
    
  • ICD (Intermittently Connected Devices)
    Full support for Matter 1.2+ ICD commissioning via:

    CompletionListener.onICDRegistrationComplete
    
  • Attribute read
    Read any attribute from any cluster.

  • Attribute write
    Write any attribute to any cluster.

  • Attribute / event subscribe
    Subscribe with optional DataVersionFilter for efficient change-only updates.

  • Invoke
    Send commands to any cluster endpoint.

  • Unpair
    Remove a device from the fabric with:

    unPairDevice(nodeId)
    
  • TLV
    Full TLV read/write stack for advanced low-level control.

  • Cluster helpers
    Convenience wrappers for:

    • BasicInformationCluster
    • DescriptorCluster

🚀 Getting Started

Android

Make sure the following permissions are added to your AndroidManifest.xml:

<!-- Tell Google Play Store that your app uses Bluetooth LE -->
<!-- Set android:required="true" if Bluetooth is required -->
<uses-feature
    android:name="android.hardware.bluetooth_le"
    android:required="false" />

<!-- Android 12+ Bluetooth permissions -->
<uses-permission
    android:name="android.permission.BLUETOOTH_SCAN"
    android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

<!-- Android 11 and lower -->
<uses-permission
    android:name="android.permission.BLUETOOTH"
    android:maxSdkVersion="30" />
<uses-permission
    android:name="android.permission.BLUETOOTH_ADMIN"
    android:maxSdkVersion="30" />
<uses-permission
    android:name="android.permission.ACCESS_FINE_LOCATION"
    android:maxSdkVersion="30" />

<!-- Android 9 and lower -->
<uses-permission
    android:name="android.permission.ACCESS_COARSE_LOCATION"
    android:maxSdkVersion="28" />

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

iOS

1. Add the required keys to Info.plist

<key>NSBluetoothAlwaysUsageDescription</key>
<string>This app uses Bluetooth to connect to nearby devices for communication.</string>

<key>NSBonjourServices</key>
<array>
  <string>_meshcop._udp</string>
  <string>_matter._tcp</string>
  <string>_matterc._udp</string>
  <string>_matterd._udp</string>
</array>

<key>NSCameraUsageDescription</key>
<string>This app needs camera access to scan QR codes.</string>

<key>NSLocalNetworkUsageDescription</key>
<string>Required to discover local network devices.</string>

2. Add a Matter Extension to your project

Add Matter Extension

3. Add capabilities to both targets

In both the main app target and the Matter Extension target, add:

  • App Groups
  • Matter Allow Setup Payload

Make sure both targets use the same App Group.

App Groups setup

4. Add AppGroupId to both targets

In the Info section of both the main app target and the Matter Extension target, add:

  • Key: AppGroupId
  • Value: the same App Group value selected in step 3

This allows data sharing between the two targets.

Info.plist AppGroupId configuration

5. Copy the request handler code

Copy the contents of:

example/ios/MatterExt/RequestHandler.swift

into your Matter Extension’s:

RequestHandler.swift

▶️ Run the Example

iOS

Open the following workspace in Xcode:

example/ios/Runner.xcworkspace

Then:

  1. Fill in your signing information
  2. Complete the iOS setup steps above

Android

No additional setup is required.

Start the example

cd example
flutter pub get
flutter run

📌 Notes

  • Images are displayed using fixed widths to keep them clean and prevent stretching.
  • Centered screenshots and demo media usually make plugin documentation look much better.
  • This README keeps the setup simple while still looking polished and professional.

🤝 Contributing

Contributions, issues, and feature requests are welcome.

If you find this plugin useful, consider giving it a star.