getCalls method

Future<List<FCXCall>> getCalls()

Retrieve the current call list, blocking on initial state retrieval if necessary.

Implementation

Future<List<FCXCall>> getCalls() async {
  try {
    String method = 'getCalls';
    var data = await _methodChannel.invokeListMethod<Map>(
      '$_CALL_CONTROLLER.$method',
    );
    _FCXLog._i(runtimeType, method);
    if (data == null) {
      _FCXLog._w(runtimeType, 'Empty data received, processing skipped');
      return [];
    } else {
      return data.map((f) => FCXCall._fromMap(f)).toList();
    }
  } on PlatformException catch (e) {
    var exception = FCXException(e.code, e.message);
    _FCXLog._e(runtimeType, exception);
    throw exception;
  }
}