link static method

void link(
  1. Map params,
  2. dynamic onSuccess()?,
  3. dynamic onError(
    1. ErrorModel error
    )?
)

link Customer

Callback void on success Throw ErrorModel if there is some error during the processs

Implementation

static void link(Map params, Function()? onSuccess,
    Function(ErrorModel error)? onError) async {
  await _indigitall
      .invokeMethod(_ACTION_LINK, params)
      .then((value) => {
            if (value != null)
              {
                value.forEach((key, valueMap) {
                  if (key == _CALLBACK_CUSTOMER) {
                    if (onSuccess != null) onSuccess();
                  }
                })
              }
          })
      .catchError((error) => {
            if (error is PlatformException)
              {
                if (onError != null)
                  onError(ErrorModel(error.code, error.message))
              }
          });
}