fromName static method

ScreenStateEvent fromName(
  1. String name
)

Returns the enum value from the name.

Implementation

static ScreenStateEvent fromName(String name) {
  switch (name) {
    case 'SCREEN_UNLOCKED':
    case 'android.intent.action.USER_PRESENT': // Android only 'USER_PRESENT
      return ScreenStateEvent.SCREEN_UNLOCKED;
    case 'SCREEN_ON':
    case 'android.intent.action.SCREEN_ON': // Android only 'SCREEN_ON'
      return ScreenStateEvent.SCREEN_ON;
    case 'SCREEN_OFF':
    case 'android.intent.action.SCREEN_OFF': // Android only 'SCREEN_OFF'
      return ScreenStateEvent.SCREEN_OFF;
    default:
      throw ArgumentError('Unknown ScreenStateEvent: $name');
  }
}