Unhandled Exception: Bad state: No element flutter code example
Example: StateError (Bad state: No element)
// Use the orElse and set it to null.
someIterable.firstWhere(test, orElse: () => null);
// Use the orElse and set it to null.
someIterable.firstWhere(test, orElse: () => null);