@@ -7,25 +7,25 @@ Flutter bindings for [Computed](https://github.com/mstniy/computed.dart).
7
7
8
8
Computed Flutter allows you to interface Computed with Flutter-specific functionality, like ` Widget ` s and ` Listenable ` s.
9
9
10
- ## <a name =' Tableofcontents ' ></a >Table of contents
10
+ ## <a name =' table-of-contents ' ></a >Table of contents
11
11
12
12
<!-- vscode-markdown-toc -->
13
13
14
- - [ Here's how it works] ( #Hereshowitworks )
15
- - [ Using Computed with widgets] ( #UsingComputedwithwidgets )
16
- - [ Using ` Computed[Stateful]Widget ` ] ( #UsingComputedStatefulWidget )
17
- - [ Using ` ComputedFlutter[Stateful]Mixin ` ] ( #UsingComputedFlutterStatefulMixin )
18
- - [ Using ` ComputedBuilder ` ] ( #UsingComputedBuilder )
19
- - [ Ingesting data sources] ( #Ingestingdatasources )
20
- - [ Using results of computations] ( #Usingresultsofcomputations )
14
+ - [ Here is how it works] ( #here-is-how-it-works )
15
+ - [ Using Computed with widgets] ( #using-computed-with-widgets )
16
+ - [ Using ` Computed[Stateful]Widget ` ] ( #using-`computed[stateful]widget` )
17
+ - [ Using ` ComputedFlutter[Stateful]Mixin ` ] ( #using-`computedflutter[stateful]mixin` )
18
+ - [ Using ` ComputedBuilder ` ] ( #using-`computedbuilder` )
19
+ - [ Ingesting data sources] ( #ingesting-data-sources )
20
+ - [ Using results of computations] ( #using-results-of-computations )
21
21
22
22
<!-- vscode-markdown-toc-config
23
23
numbering=false
24
24
autoSave=true
25
25
/vscode-markdown-toc-config -->
26
26
<!-- /vscode-markdown-toc -->
27
27
28
- ## <a name =' Hereshowitworks ' ></a >Here's how it works
28
+ ## <a name =' here-is-how-it-works ' ></a >Here is how it works
29
29
30
30
Assume you have a data source, like a ` ValueListenable ` representing some external state:
31
31
@@ -43,12 +43,12 @@ Text('${v.use}')
43
43
44
44
Note that this does not use code generation, nor does it restrict your codebase to have at most one data source per object type.
45
45
46
- ## <a name =' UsingComputedwithwidgets ' ></a >Using Computed with widgets
46
+ ## <a name =' using-computed-with-widgets ' ></a >Using Computed with widgets
47
47
48
48
Using Computed facilities, like ` .use ` and ` .react ` , inside the ` build ` methods of widgets requires Computed to be aware of them.
49
49
You can achieve this in several ways:
50
50
51
- ### <a name =' UsingComputedStatefulWidget ' ></a >Using ` Computed[Stateful]Widget `
51
+ ### <a name =' using-`computed[stateful]widget` ' ></a >Using ` Computed[Stateful]Widget `
52
52
53
53
If you have a custom widget, extending ` StatelessWidget ` or ` StatefulWidget ` , modify them to extend ` ComputedWidget ` or ` ComputedStatefulWidget ` instead:
54
54
@@ -62,7 +62,7 @@ class MyWidget extends ComputedWidget {
62
62
}
63
63
```
64
64
65
- ### <a name =' UsingComputedFlutterStatefulMixin ' ></a >Using ` ComputedFlutter[Stateful]Mixin `
65
+ ### <a name =' using-`computedflutter[stateful]mixin` ' ></a >Using ` ComputedFlutter[Stateful]Mixin `
66
66
67
67
If you do not want your widgets to extend ` Computed[Stateful]Widget ` , perhaps for widgets already extending some other class, you can use the mixins:
68
68
@@ -76,7 +76,7 @@ class MyStatefulWidget extends MyOtherStatefulWidget with ComputedFlutterStatefu
76
76
}
77
77
```
78
78
79
- ### <a name =' UsingComputedBuilder ' ></a >Using ` ComputedBuilder `
79
+ ### <a name =' using-`computedbuilder` ' ></a >Using ` ComputedBuilder `
80
80
81
81
If you are using a widget whose definition you cannot modify, or wish to limit the scope of reactive widget rebuilds, use ` ComputedBuilder ` :
82
82
@@ -86,7 +86,7 @@ ComputedBuilder(builder: (ctx) =>
86
86
)
87
87
```
88
88
89
- ## <a name =' Ingestingdatasources ' ></a >Ingesting data sources
89
+ ## <a name =' ingesting-data-sources ' ></a >Ingesting data sources
90
90
91
91
Computed Flutter supports reactively depending on ` ValueListenable ` s with ` .use ` , as with Computed:
92
92
@@ -113,7 +113,7 @@ final c = $((){
113
113
});
114
114
```
115
115
116
- ## <a name =' Usingresultsofcomputations ' ></a >Using results of computations
116
+ ## <a name =' using-results-of-computations ' ></a >Using results of computations
117
117
118
118
Computed Flutter allows you to turn computations into ` Listenable ` s and ` ValueListenable ` s:
119
119
0 commit comments