querySms method Null safety

Future<List<SmsMessage>> querySms(
  1. {int? start,
  2. int? count,
  3. String? address,
  4. int? threadId,
  5. List<SmsQueryKind> kinds = const [SmsQueryKind.inbox],
  6. bool sort = false}
)

Query a list of SMS

Implementation

Future<List<SmsMessage>> querySms({
  int? start,
  int? count,
  String? address,
  int? threadId,
  List<SmsQueryKind> kinds = const [SmsQueryKind.inbox],
  bool sort = false,
}) async {
  List<SmsMessage> result = [];
  for (var kind in kinds) {
    result.addAll(await _querySms(
      start: start,
      count: count,
      address: address,
      threadId: threadId,
      kind: kind,
    ));
  }

  if (sort == true) {
    result.sort((a, b) => a.compareTo(b));
  }

  return (result);
}