Skip to content

Commit bce8f21

Browse files
committed
Updated Usage.
1 parent 2ad6827 commit bce8f21

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ To use the package [`generic_reader`][generic_reader] the following steps are re
2828
your pubspec.yaml file.
2929

3030
2. Register a [Decoder][Decoder] object for each *user defined*
31-
data-type `T` that is going to be read. <br/>
31+
data-type `U` that is going to be read
32+
(see section [Custom Decoders](#custom-decoders)). </br>
3233
Note: The following type are supported out-of-the-box and do *not* require a decoder:
3334
* `bool`, `double`, `int`, `num`,`String`, `Type`, `Symbol`,
3435
* `List<bool>`, `List<double>`, `List<int>`, `List<num>`,
@@ -41,13 +42,11 @@ Note: The following type are supported out-of-the-box and do *not* require a dec
4142
3. Use Dart's static [`analyzer`][analyzer] to read a library, get
4243
the relevant [`VariableElement`][VariableElement], and calculate the constant
4344
expression represented by a [`DartObject`][DartObject]
44-
using the method [`computeConstantValue()`][computeConstantValue()].
45+
using the method [`computeConstantValue()`][computeConstantValue()]. An exmple
46+
is shown in section [Reading an Enumeration](#reading-an-enumeration).
4547

4648
4. Read the compile-time constant values using the extension method: [`read<T>`][read]. <br/>
4749

48-
To read a constant of a user-defined type `U`, add a suitable `Decoder<U`
49-
(see section [Custom Decoders](#custom-decoders));
50-
5150
To read a constant representing a *collection* of a *user-defined* type `U`
5251
use the convenience methods [`readList<U>`][readList],
5352
[`readSet<U>`][readSet], [`readMap<K,U>`][readMap], and [`readIterator<U>`][readIterator].
@@ -232,10 +231,11 @@ listObj.readList<List<String>>(): [[a], [b]]
232231

233232
1) When using the type `dynamic` the static type of the [DartObject][DartObject]
234233
is used to determine the correct type of the runtime object. If a suitable
235-
decoder is registered with the [Reader][Reader] on can omit the type parameter
236-
when using e.g. [`read`][read]. For example, the variable `list2` in section
237-
[Reading a Nested List](#reading-a-nested-list) is calculated using
238-
[read][read].
234+
decoder is registered with the [Reader][Reader] it is possible
235+
(but not recommended) to omit the type parameter.
236+
For example, the variable `list2` in section
237+
[Reading a Nested List](#reading-a-nested-list) is calculated using the extension
238+
method [read][read] without specifying the type parameter.
239239

240240
2) Defining decoder functions for each data-type has its obvious limitiations when it comes to *generic types*.
241241
In practice, however, generic classes are often designed in such a manner

0 commit comments

Comments
 (0)