InstanceMirror class abstract
Provides access to fields of some object.
Use Kind.instanceMirror
to get an instance of this class.
Example
import 'package:kind/kind.dart';
void main() {
// Get example
final example = Example();
final mirror = Example.kind.instanceMirror(example);
final fieldNames = mirror.fieldNames;
print(fieldNames.join(', '));
}
// ...
- Implemented types
Constructors
- InstanceMirror.constructor()
-
const
Properties
-
fieldMirrors
→ Iterable<
FieldMirror> -
Mirrors for each field.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
compareTo(
InstanceMirror other) → int -
Compares this object to another object.
override
-
get(
String name) → Object? -
Returns value of field
name
. -
getFieldMirror(
String name) → FieldMirror -
Returns Kind of field
name
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, Object?> - Returns fields as a map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of<
T> (Object? instance, {required Kind? kind}) → InstanceMirror -
Returns an instance mirror for
instance
.
Constants
- forPrimitive → const _InstanceMirror