instanceMembers property
Returns a map of the methods, getters and setters of an instance of the class.
The intent is to capture those members that constitute the API of an instance. Hence fields are not included, but the getters and setters implicitly introduced by fields are included. The map includes methods, getters and setters that are inherited as well as those introduced by the class itself.
The map is keyed by the simple names of the members.
Required capabilities: instanceMembers requires a DeclarationsCapability.
Implementation
@override
Map<String, MethodMirror> get instanceMembers {
Map<String, MethodMirror>? instanceMembers = _instanceMembers;
if (instanceMembers == null) {
List<int>? instanceMemberIndices = _instanceMemberIndices;
if (instanceMemberIndices == null) {
throw NoSuchCapabilityError(
'Requesting instanceMembers without `declarationsCapability`.',
);
}
var result = <String, MethodMirror>{};
for (int instanceMemberIndex in instanceMemberIndices) {
DeclarationMirror declarationMirror =
_data.memberMirrors![instanceMemberIndex];
result[declarationMirror.simpleName] =
declarationMirror as MethodMirror;
}
_instanceMembers = instanceMembers =
UnmodifiableMapView<String, MethodMirror>(result);
}
return instanceMembers;
}