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.

Properties

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

Methods

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

Operators

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

Constants

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