getCard method

  1. @override
Future<CCResult> getCard()
override

Implementation

@override
Future<CCResult> getCard() async {
  try {
    final result = await methodChannel.invokeMethod('get_card');
    final ccResult = CCResult.fromMap(result);
    if(ccResult.status == Status.SUCCESS) {
      ccResult.data = (ccResult.data as List)
          .map((element) => CardData.fromMap(element))
          .toList();
    }
    return ccResult;
  } on PlatformException catch (e) {
    return CCResult(
        status: Status.ERROR, message: e.message ?? 'an error occurred');
  }
}