staticMembers property

  1. @override
Map<String, MethodMirror> get staticMembers
inherited

Returns a map of the static methods, getters and setters of the class.

The intent is to capture those members that constitute the API of a class. Hence fields are not included, but the getters and setters implicitly introduced by fields are included.

The map is keyed by the simple names of the members.

Required capabilities: staticMembers requires a DeclarationsCapability.

Implementation

@override
Map<String, MethodMirror> get staticMembers {
  Map<String, MethodMirror>? staticMembers = _staticMembers;
  if (staticMembers == null) {
    List<int>? staticMemberIndices = _staticMemberIndices;
    if (staticMemberIndices == null) {
      throw NoSuchCapabilityError(
        'Requesting instanceMembers without `declarationsCapability`.',
      );
    }
    var result = <String, MethodMirror>{};
    for (int staticMemberIndex in staticMemberIndices) {
      DeclarationMirror declarationMirror =
          _data.memberMirrors![staticMemberIndex];
      assert(declarationMirror is MethodMirror);
      result[declarationMirror.simpleName] =
          declarationMirror as MethodMirror;
    }
    staticMembers = _staticMembers =
        UnmodifiableMapView<String, MethodMirror>(result);
  }
  return staticMembers;
}