Type class

Runtime representation of a type.

Type objects represent types. A type object can be created in several ways:

  • By a type literal, a type name occurring as an expression, like Type type = int;, or a type variable occurring as an expression, like Type type = T;.
  • By reading the run-time type of an object, like Type type = o.runtimeType;.
  • Through dart:mirrors.

A type object is intended as an entry point for using dart:mirrors. The only operations supported are comparing to other type objects for equality, and converting it to a string for debugging.

Constructors

Type()

Properties

hashCodeint
read-only, override
A hash code for the type which is compatible with operator==.
runtimeTypeType
read-only, inherited
A representation of the runtime type of the object.

Methods

noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed. [...]
toString() → String
override
Returns a string which represents the underlying type. [...]

Operators

operator ==(Object other) → bool
override
Whether other is a Type instance representing an equivalent type. [...]

© 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/Type-class.html