StateError class

The operation was not allowed by the current state of the object.

Should be used when this particular object is currenty in a state which doesn't support the requested operation, but other similar objects might, or the object might change its state to one which supports the operation. Example: Asking for list.first on a currently empty list. If the operation is never supported, consider using UnsupportedError instead.

This is a generic error used for a variety of different erroneous actions. The message should be descriptive.

Inheritance

Constructors

StateError(String message)

Properties

hashCodeint
read-only, inherited
The hash code for this object. [...]
messageString
final
runtimeTypeType
read-only, inherited
A representation of the runtime type of the object.
stackTraceStackTrace?
read-only, inherited
The stack trace at the point where this error was first thrown. [...]

Methods

noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed. [...]
toString() → String
override
A string representation of this object. [...]

Operators

operator ==(Object other) → bool
inherited
The equality operator. [...]

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-core/StateError-class.html