getAllRecords method

Future<List?> getAllRecords({
  1. required String type,
})

Implementation

Future<List<dynamic>?> getAllRecords({
  required String type,
}) async {
  try {
    final data = await _methodChannel.invokeMethod(
      'getAllRecords',
      {
        'type': type,
      },
    ) as List<dynamic>?;

    return data?.map((e) => jsonDecode(e)).toList();
  } catch (err) {
    if (err is PlatformException && (err.message?.contains('Did not find record type: $type') ?? false)) {
      return [];
    }
    throw _mapException(err as PlatformException);
  }
}