listChannels method

  1. @override
Future<List<ChannelInfo>> listChannels()
override

Lists all available event log channels on the system.

Returns a list of ChannelInfo objects containing information about each channel (e.g., "System", "Application", "Security").

Throws EventLogException if the operation fails.

Implementation

@override
Future<List<ChannelInfo>> listChannels() async {
  try {
    final result = await methodChannel.invokeMethod<List>('listChannels');
    if (result == null) return [];

    return result
        .cast<Map>()
        .map((map) => ChannelInfo.fromMap(Map<String, dynamic>.from(map)))
        .toList();
  } on PlatformException catch (e) {
    throw _handlePlatformException(e);
  }
}