I currently use:
int get displayFlex => displaySegment == null
? throw StateError("Note is not yet processed by the Widget")
: displaySegment!.flex;
The fact that I need to use !
after displaySegment!
makes me think that there might be a better way to write this code. Is there a better pattern?