logIn static method

void logIn(
  1. String externalId,
  2. dynamic onSuccess(
    1. Device device
    )?,
  3. dynamic onError(
    1. ErrorModel error
    )?
)

Set Log in with external Id

externalId param String with the code Callback to get Device info Throw ErrorModel if there is some error during the processs

Implementation

static void logIn(String externalId, Function(Device device)? onSuccess,
    Function(ErrorModel error)? onError) async {
  _indigitall
      .invokeMapMethod(_ACTION_LOGIN, externalId)
      .then((value) => {
            if (value != null)
              {
                value.forEach((key, valueMap) {
                  if (key == _CALLBACK_LOGIN) {
                    if (onSuccess != null) {
                      onSuccess(new Device(valueMap));
                    }
                  }
                })
              }
          })
      .catchError((error) => {
            if (error is PlatformException)
              {
                if (onError != null)
                  onError(ErrorModel(error.code, error.message))
              }
          });
}