getEventColors method

  1. @override
Future<Map<String, int>?> getEventColors(
  1. String calendarId
)
override

Retrieve available event colors for a specific calendar Returns a map of color keys to color values Throws PermissionDeniedException if permissions are not granted Throws CalendarNotFoundException if the calendar doesn't exist

Implementation

@override
Future<Map<String, int>?> getEventColors(String calendarId) async {
  try {
    final result = await _methodChannel.invokeMethod<Map<dynamic, dynamic>>(
      'retrieveEventColors',
      {'calendarId': calendarId},
    );

    if (result == null) return null;

    return Map<String, int>.from(result as Map<Object?, Object?>);
  } on PlatformException catch (e) {
    throw _mapPlatformException(e);
  } catch (e) {
    throw PlatformBridgeException('Failed to parse event colors: $e');
  }
}