discoverDevice method

  1. @override
Future<List<MatterEndpoint>> discoverDevice(
  1. int deviceId
)
override

Queries the device for its endpoints, device types and supported clusters, so capabilities can be derived from the Matter spec rather than guessed from the device's name.

Implementation

@override
Future<List<MatterEndpoint>> discoverDevice(int deviceId) async {
  final endpoints = await methodChannel.invokeMethod<List>('discoverDevice', [deviceId]);
  if (endpoints == null) return [];
  return endpoints
      .cast<Map>()
      .map((endpointMap) => MatterEndpoint.fromMap(endpointMap))
      .toList();
}