Skip to content

Commit 30ad156

Browse files
nateboschmatanlurey
authored andcommitted
Document throwing behavior of ConstantReader.read (#242)
* Document throwing behavior of ConstantReader.read Closes #215 * Change to [] for the link
1 parent 2751044 commit 30ad156

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/src/constants.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ DartObject _getFieldRecursive(DartObject object, String field) {
4646

4747
/// A wrapper for analyzer's [DartObject] with a predictable high-level API.
4848
///
49-
/// Unlike [DartObject.getField], all `readX` methods attempt to access super
49+
/// Unlike [DartObject.getField], the [read] method attempts to access super
5050
/// classes for the field value if not found.
5151
abstract class ConstantReader {
5252
factory ConstantReader(DartObject object) =>
@@ -145,7 +145,11 @@ abstract class ConstantReader {
145145
/// Returns whether this constant matches [checker].
146146
bool instanceOf(TypeChecker checker);
147147

148-
/// Reads[ field] from the constant as another constant value.
148+
/// Reads [field] from the constant as another constant value.
149+
///
150+
/// If the field is not present in the [DartObject] crawl up the chain of
151+
/// super classes until it is found. If the field is not present throw a
152+
/// [FormatException].
149153
ConstantReader read(String field);
150154

151155
/// Returns as a revived meta class.

0 commit comments

Comments
 (0)