getGroupMembers method Null safety

Future<List<JMGroupMemberInfo>> getGroupMembers(
  1. {required String? id}
)

Implementation

Future<List<JMGroupMemberInfo>> getGroupMembers({required String? id}) async {
  List membersJsons = await _channel.invokeMethod('getGroupMembers',
      {'id': id}..removeWhere((key, value) => value == null));

  List<JMGroupMemberInfo> res = membersJsons
      .map((memberJson) => JMGroupMemberInfo.fromJson(memberJson))
      .toList();
  return res;
}