getPublicFieldsFrom function

Map<String, DeclarationMirror?>? getPublicFieldsFrom(
  1. ClassMirror classMirror
)

Get the list of public variables DeclarationMirror from classMirror

Implementation

Map<String, DeclarationMirror?>? getPublicFieldsFrom(ClassMirror classMirror) =>
    classMirror.getters
        ?.where((getter) => classMirror.setters?.contains(getter) == true)
        .fold(<String, DeclarationMirror?>{}, (publicFields, getter) {
      if (!getter.startsWith('_'))
        publicFields?[getter] = classMirror.fields?[getter];
      return publicFields;
    });