FaceAuthenticatorEvent.fromMap constructor

FaceAuthenticatorEvent.fromMap(
  1. Map map
)

Implementation

factory FaceAuthenticatorEvent.fromMap(Map map) {
  switch (map['event']) {
    case 'connecting':
      return const FaceAuthenticatorEventConnecting();
    case 'connected':
      return const FaceAuthenticatorEventConnected();
    case 'validating':
      return const FaceAuthenticatorEventConnecting();
    case 'validated':
      return const FaceAuthenticatorEventConnected();
    case 'canceled':
      return const FaceAuthenticatorEventClosed();
    case 'success':
      return new FaceAuthenticatorEventSuccess(map['signedResponse']);
    case 'failure':
      return new FaceAuthenticatorEventFailure(
          signedResponse: map["signedResponse"],
          errorType: map["errorType"],
          errorMessage: map["errorMessage"],
          code: map["code"]);
    case 'error':
      return new FaceAuthenticatorEventFailure(
          errorType: map["errorType"],
          errorMessage: map["errorMessage"],
          code: map["code"]);
  }
  throw Exception('Invalid event');
}