You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-10Lines changed: 24 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,29 +5,43 @@
5
5
6
6
## Introduction
7
7
8
-
Source code generation has become an important software development tool when building and maintaining a large number of data models, data access object, widgets, etc.
8
+
Source code generation has become an important software development tool
9
+
when building and maintaining a large number of data models,
10
+
data access object, widgets, etc.
9
11
10
12
The premise of *source code generation* is that we can specify
11
-
(hopefully few) details and flesh out the rest of the classes, and methods during the build process.
13
+
(hopefully few) details and flesh out the rest of the classes,
14
+
and methods during the build process.
12
15
13
-
The build process consists of scannig the appropriate files, extracting the required information,
14
-
generating the source code, and writing the source code to certain files. The build process
15
-
also entails keeping track of files changes, delete conflicting files, reporting issues and progress, etc.
16
+
The build process consists of scannig the appropriate files,
17
+
extracting the required information,
18
+
generating the source code, and writing the source code to certain files.
19
+
The build process
20
+
also entails keeping track of files changes,
21
+
delete conflicting files, reporting issues and progress.
16
22
17
23
Source code generation using Dart relies heavily on *constants* known at compile time.
18
24
Dart's static [`analyzer`][analyzer] provides access to libraries, classes,
19
25
class fields, class methods, functions, variables, etc in the form of [`Elements`][Elements].
20
-
Compile-time constant expressions are represented by a [`DartObject`][DartObject] and can be accessed by using [`computeConstantValue()`][computeConstantValue()] a method available for elements representing a variable.
26
+
Compile-time constant expressions are represented by a [`DartObject`][DartObject]
27
+
and can be accessed by using [`computeConstantValue()`][computeConstantValue()] a method available for elements representing a variable.
21
28
22
-
In practice, we mark constant constant classes with annotations and instruct the builder to processes only
23
-
the annotated objects.
29
+
In practice, we mark constant constant classes with annotations and instruct
30
+
the builder to processes only the annotated objects.
24
31
25
32
26
33
The library [`merging_builder`][merging_builder] includes the following (synthetic input) builder classes:
27
34
28
-
*[`MergingBuilder`][class-merging-builder] reads **several input files** and writes merged output to **one output file**. The builder provides the option to sort the processing order of the input files in reverse topological order.
35
+
*[`MergingBuilder`][class-merging-builder] reads **several input files** and writes
36
+
merged output to **one output file**. The builder provides the option to
37
+
sort the processing order of the input files in reverse topological order.
38
+
(In the file `build.yaml`, under builder `options` set: `sort_assets: true`).
29
39
30
-
*[`StandaloneBuilder`][StandaloneBuilder] reads one or several input files and writes standalone files to a custom location. In this context, **standalone** means the output files may be written to a **custom folder** and not only the **extension** but the **name** of the output file can be configured (as opposed to using part files).
40
+
*[`StandaloneBuilder`][StandaloneBuilder] reads one or several input files and
41
+
writes standalone files to a custom location. In this context, **standalone**
42
+
means the output files may be written to a **custom folder** and
43
+
not only the **extension** but the **name** of the output file can
0 commit comments