getCustomer method

  1. @override
Future<Customer> getCustomer({
  1. required String customerId,
})
override

Get the customer data.

Implementation

@override
Future<Customer> getCustomer({required String customerId}) async {
  try {
    final result = await methodChannel.invokeMethod<Map<dynamic, dynamic>>(
      'getCustomer',
      {'customerId': customerId},
    );
    if (result != null) {
      final customerMap = Map<String, dynamic>.from(result);
      final customer = Customer.fromMap(customerMap);
      return customer;
    } else {
      throw PlatformException(
        code: 'NULL_RESULT',
        message: 'getCustomer returned null',
      );
    }
  } on PlatformException {
    rethrow;
  }
}