getAttendees method Null safety

Future<List<Attendee>?> getAttendees(
  1. {required String eventId}
)

Returns all the available Attendees on the selected event

Implementation

Future<List<Attendee>?> getAttendees({
  required String eventId,
}) async {
  List<Attendee>? attendees;
  try {
    String attendeesJson =
        await _channel.invokeMethod('getAttendees', <String, Object?>{
      'eventId': eventId,
    });
    attendees = json.decode(attendeesJson).map<Attendee>((decodedAttendee) {
      return Attendee.fromJson(decodedAttendee);
    }).toList();
  } catch (e) {
    print(e);
  }

  return attendees;
}