Unit class

The Unit class represents the void type in Dart.

Dart does not have a separate void type, but rather uses the void keyword to indicate that a function does not return a value. However, sometimes it is useful to have a value that represents void, for example when defining a generic function or class that takes a parameter of type void.

The Unit class provides a single value, unit, that represents void. This value can be used in place of void when defining functions or classes that take a parameter of type void.


hashCode int
Returns a hash code for this Unit object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
Returns a string representation of this Unit object.


operator ==(Object other) bool
Compares this Unit object to another object to see if they are equal.


unit → const Unit
A single value of type Unit that represents void.