logIn static method
void
logIn(
- String externalId,
- dynamic onSuccess(
- Device device
- dynamic onError(
- 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))
}
});
}