query method

  1. @override
Future<List<CallLogEntry>> query(
  1. CallLogQuery query
)
override

Implementation

@override
Future<List<CallLogEntry>> query(CallLogQuery query) async {
  try {
    final result = await _channel.invokeMethod<List<dynamic>>(
      'getCallLogs',
      query.toMap(),
    );

    if (result == null) return [];

    return result.map((e) => CallLogEntry.fromMap(e)).toList();
  } on PlatformException catch (e) {
    throw CallLogException(e.code, e.message ?? 'Platform error');
  } catch (e) {
    throw CallLogException('UNKNOWN_ERROR', e.toString());
  }
}