listDisplays static method
Get list of available displays
category is optional (Android only):
- null: All displays
- "android.hardware.display.category.PRESENTATION": Presentation displays only
Implementation
static Future<List<DisplayInfo>> listDisplays([String? category]) async {
try {
final String? result = await _channel.invokeMethod('listDisplay', category);
if (result == null || result.isEmpty) {
return [];
}
final List<dynamic> jsonList = json.decode(result);
return jsonList.map((json) => DisplayInfo.fromJson(json as Map<String, dynamic>)).toList();
} catch (e) {
print('Error listing displays: $e');
return [];
}
}