read static method
Apple's appleValue read as a member: unknown for a value this version
does not name, null when Apple sent nothing.
The only place Apple's spellings are compared to anything. A switch
case pattern must be a compile-time constant and processing.appleValue
is not one, so code branching on the state used to switch on string
literals — 'PROCESSING' written in the enum and again in every branch
that cared. Reading to a member first makes those enum switches, which is
one copy of each spelling and exhaustive.
Implementation
static ProcessingState? read(String? appleValue) => appleValue == null
? null
: values.firstWhere(
(s) => s.appleValue == appleValue,
orElse: () => unknown,
);