fromString method

MonoEvent fromString(
  1. String value
)

convert a string value to a Mono event

Implementation

MonoEvent fromString(String value) {
  switch (value.toUpperCase()) {
    case 'INSTITUTION_SELECTED':
      return MonoEvent.institutionSelected;
    case 'AUTH_METHOD_SWITCHED':
      return MonoEvent.authMethodSwitched;
    case 'SUBMIT_CREDENTIALS':
      return MonoEvent.submitCredentials;
    case 'ACCOUNT_LINKED':
      return MonoEvent.accountLinked;
    case 'ACCOUNT_SELECTED':
      return MonoEvent.accountSelected;

    default:
  }
  final event =
      MonoEvent.values.where((e) => e.name == value.toLowerCase()).toList();

  return event.isNotEmpty ? event[0] : MonoEvent.unknown;
}