jonataslaw

update benchmark

Showing 122 changed files with 197 additions and 860 deletions
1 -# Benchmarks 1 +# benchmarks
  2 +A repository to benchmark Flutter libs.
  3 +Creators of the tested libs can suggest improvements, as long as they follow the same design structure.
2 4
3 -Start the project, compile in PROFILE MODE (the debug mode is inconsistent for checking benchmarks), open the Dart inspector, and check the amount of ram used. 5 +# 1- State Managers
4 6
5 -To be fair, the test was done twice: after the state changes, and after Dart's garbage collection (by manually pressing the garbage collector on the dart inspect). 7 +![](benchmark.png)
6 8
7 -Start testing and see for yourself. 9 +The idle application consumes 4.288k of ram.
  10 +Items were added dynamically to a ListView.
  11 +The amount of RAM was measured after the test, and the following calculation was made:
  12 +Number of RAM consumed by the app after testing with the state manager - RAM in idle state without any state manager.
8 13
9 -The test measures RAM consumption, so the lower the better.  
10 -  
11 -## No GC  
12 -  
13 -Mobx = 4.58  
14 -  
15 -Bloc = 4.56  
16 -  
17 -Redux = 4.56  
18 -  
19 -Bloc-Lib = 4.55  
20 -  
21 -Provider = 4.55  
22 -  
23 -GetX = 4.53  
24 -  
25 -Get = 4.53  
26 -  
27 -## GC  
28 -  
29 -Bloc-lib = 4.22  
30 -  
31 -Mobx = 4.18  
32 -  
33 -Bloc = 4.16  
34 -  
35 -Redux = 4.16  
36 -  
37 -Provider = 4.15  
38 -  
39 -Get = 4.14  
40 -  
41 -GetX = 4.13 14 +In addition to the RAM calculation, the size of the apk was also observed after compilation. And we had the following results:
42 15
  16 +- flutter_bloc: 8.3mb
  17 +- mobx: 8.3mb
  18 +- provider: 8.3mb
  19 +- redux: 8.2mb
  20 +- get: 8.2mb
  21 +- getx: 8.2mb
43 22
  23 +The creators of flutter_bloc and provider made changes to use their library. If you want to make changes (within the scope of the project, without eliminating classes), you can do so by offering a PR.
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<module type="JAVA_MODULE" version="4">  
3 - <component name="FacetManager">  
4 - <facet type="android" name="Android">  
5 - <configuration>  
6 - <option name="ALLOW_USER_CONFIGURATION" value="false" />  
7 - <option name="MANIFEST_FILE_RELATIVE_PATH" value="/app/src/main/AndroidManifest.xml" />  
8 - <option name="RES_FOLDER_RELATIVE_PATH" value="/app/src/main/res" />  
9 - <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/app/src/main/assets" />  
10 - <option name="LIBS_FOLDER_RELATIVE_PATH" value="/app/src/main/libs" />  
11 - <option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/app/src/main/proguard_logs" />  
12 - </configuration>  
13 - </facet>  
14 - </component>  
15 - <component name="NewModuleRootManager" inherit-compiler-output="true">  
16 - <exclude-output />  
17 - <content url="file://$MODULE_DIR$">  
18 - <sourceFolder url="file://$MODULE_DIR$/app/src/main/java" isTestSource="false" />  
19 - <sourceFolder url="file://$MODULE_DIR$/app/src/main/kotlin" isTestSource="false" />  
20 - <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />  
21 - </content>  
22 - <orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />  
23 - <orderEntry type="sourceFolder" forTests="false" />  
24 - <orderEntry type="library" name="Flutter for Android" level="project" />  
25 - <orderEntry type="library" name="KotlinJavaRuntime" level="project" />  
26 - </component>  
27 -</module>  
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<module type="JAVA_MODULE" version="4">  
3 - <component name="FacetManager">  
4 - <facet type="android" name="Android">  
5 - <configuration>  
6 - <option name="ALLOW_USER_CONFIGURATION" value="false" />  
7 - <option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />  
8 - <option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />  
9 - <option name="MANIFEST_FILE_RELATIVE_PATH" value="/app/src/main/AndroidManifest.xml" />  
10 - <option name="RES_FOLDER_RELATIVE_PATH" value="/app/src/main/res" />  
11 - <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/app/src/main/assets" />  
12 - <option name="LIBS_FOLDER_RELATIVE_PATH" value="/app/src/main/libs" />  
13 - <option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/app/src/main/proguard_logs" />  
14 - </configuration>  
15 - </facet>  
16 - </component>  
17 - <component name="NewModuleRootManager" inherit-compiler-output="true">  
18 - <exclude-output />  
19 - <content url="file://$MODULE_DIR$">  
20 - <sourceFolder url="file://$MODULE_DIR$/app/src/main/java" isTestSource="false" />  
21 - <sourceFolder url="file://$MODULE_DIR$/app/src/main/kotlin" isTestSource="false" />  
22 - <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />  
23 - </content>  
24 - <orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />  
25 - <orderEntry type="sourceFolder" forTests="false" />  
26 - <orderEntry type="library" name="Flutter for Android" level="project" />  
27 - <orderEntry type="library" name="KotlinJavaRuntime" level="project" />  
28 - </component>  
29 -</module>  
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<module type="JAVA_MODULE" version="4">  
3 - <component name="NewModuleRootManager" inherit-compiler-output="true">  
4 - <exclude-output />  
5 - <content url="file://$MODULE_DIR$">  
6 - <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />  
7 - <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />  
8 - <excludeFolder url="file://$MODULE_DIR$/.dart_tool" />  
9 - <excludeFolder url="file://$MODULE_DIR$/.idea" />  
10 - <excludeFolder url="file://$MODULE_DIR$/.pub" />  
11 - <excludeFolder url="file://$MODULE_DIR$/build" />  
12 - </content>  
13 - <orderEntry type="sourceFolder" forTests="false" />  
14 - <orderEntry type="library" name="Dart SDK" level="project" />  
15 - <orderEntry type="library" name="Flutter Plugins" level="project" />  
16 - <orderEntry type="library" name="Dart Packages" level="project" />  
17 - </component>  
18 -</module>  
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<module type="JAVA_MODULE" version="4">  
3 - <component name="NewModuleRootManager" inherit-compiler-output="true">  
4 - <exclude-output />  
5 - <content url="file://$MODULE_DIR$">  
6 - <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />  
7 - <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />  
8 - <excludeFolder url="file://$MODULE_DIR$/.dart_tool" />  
9 - <excludeFolder url="file://$MODULE_DIR$/.idea" />  
10 - <excludeFolder url="file://$MODULE_DIR$/.pub" />  
11 - <excludeFolder url="file://$MODULE_DIR$/build" />  
12 - </content>  
13 - <orderEntry type="sourceFolder" forTests="false" />  
14 - <orderEntry type="library" name="Dart SDK" level="project" />  
15 - <orderEntry type="library" name="Flutter Plugins" level="project" />  
16 - <orderEntry type="library" name="Dart Packages" level="project" />  
17 - </component>  
18 -</module>  
1 -// !$*UTF8*$!  
2 -{  
3 - archiveVersion = 1;  
4 - classes = {  
5 - };  
6 - objectVersion = 46;  
7 - objects = {  
8 -  
9 -/* Begin PBXBuildFile section */  
10 - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };  
11 - 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };  
12 - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };  
13 - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };  
14 - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };  
15 - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };  
16 - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };  
17 - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };  
18 - 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };  
19 - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };  
20 - 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };  
21 - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };  
22 - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };  
23 - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };  
24 -/* End PBXBuildFile section */  
25 -  
26 -/* Begin PBXCopyFilesBuildPhase section */  
27 - 9705A1C41CF9048500538489 /* Embed Frameworks */ = {  
28 - isa = PBXCopyFilesBuildPhase;  
29 - buildActionMask = 2147483647;  
30 - dstPath = "";  
31 - dstSubfolderSpec = 10;  
32 - files = (  
33 - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,  
34 - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,  
35 - );  
36 - name = "Embed Frameworks";  
37 - runOnlyForDeploymentPostprocessing = 0;  
38 - };  
39 -/* End PBXCopyFilesBuildPhase section */  
40 -  
41 -/* Begin PBXFileReference section */  
42 - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };  
43 - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };  
44 - 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };  
45 - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };  
46 - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };  
47 - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };  
48 - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };  
49 - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };  
50 - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };  
51 - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };  
52 - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };  
53 - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };  
54 - 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };  
55 - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };  
56 - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };  
57 - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };  
58 - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };  
59 -/* End PBXFileReference section */  
60 -  
61 -/* Begin PBXFrameworksBuildPhase section */  
62 - 97C146EB1CF9000F007C117D /* Frameworks */ = {  
63 - isa = PBXFrameworksBuildPhase;  
64 - buildActionMask = 2147483647;  
65 - files = (  
66 - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,  
67 - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,  
68 - );  
69 - runOnlyForDeploymentPostprocessing = 0;  
70 - };  
71 -/* End PBXFrameworksBuildPhase section */  
72 -  
73 -/* Begin PBXGroup section */  
74 - 9740EEB11CF90186004384FC /* Flutter */ = {  
75 - isa = PBXGroup;  
76 - children = (  
77 - 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,  
78 - 3B80C3931E831B6300D905FE /* App.framework */,  
79 - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,  
80 - 9740EEBA1CF902C7004384FC /* Flutter.framework */,  
81 - 9740EEB21CF90195004384FC /* Debug.xcconfig */,  
82 - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,  
83 - 9740EEB31CF90195004384FC /* Generated.xcconfig */,  
84 - );  
85 - name = Flutter;  
86 - sourceTree = "<group>";  
87 - };  
88 - 97C146E51CF9000F007C117D = {  
89 - isa = PBXGroup;  
90 - children = (  
91 - 9740EEB11CF90186004384FC /* Flutter */,  
92 - 97C146F01CF9000F007C117D /* Runner */,  
93 - 97C146EF1CF9000F007C117D /* Products */,  
94 - CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,  
95 - );  
96 - sourceTree = "<group>";  
97 - };  
98 - 97C146EF1CF9000F007C117D /* Products */ = {  
99 - isa = PBXGroup;  
100 - children = (  
101 - 97C146EE1CF9000F007C117D /* Runner.app */,  
102 - );  
103 - name = Products;  
104 - sourceTree = "<group>";  
105 - };  
106 - 97C146F01CF9000F007C117D /* Runner */ = {  
107 - isa = PBXGroup;  
108 - children = (  
109 - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,  
110 - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,  
111 - 97C146FA1CF9000F007C117D /* Main.storyboard */,  
112 - 97C146FD1CF9000F007C117D /* Assets.xcassets */,  
113 - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,  
114 - 97C147021CF9000F007C117D /* Info.plist */,  
115 - 97C146F11CF9000F007C117D /* Supporting Files */,  
116 - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,  
117 - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,  
118 - );  
119 - path = Runner;  
120 - sourceTree = "<group>";  
121 - };  
122 - 97C146F11CF9000F007C117D /* Supporting Files */ = {  
123 - isa = PBXGroup;  
124 - children = (  
125 - 97C146F21CF9000F007C117D /* main.m */,  
126 - );  
127 - name = "Supporting Files";  
128 - sourceTree = "<group>";  
129 - };  
130 -/* End PBXGroup section */  
131 -  
132 -/* Begin PBXNativeTarget section */  
133 - 97C146ED1CF9000F007C117D /* Runner */ = {  
134 - isa = PBXNativeTarget;  
135 - buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;  
136 - buildPhases = (  
137 - 9740EEB61CF901F6004384FC /* Run Script */,  
138 - 97C146EA1CF9000F007C117D /* Sources */,  
139 - 97C146EB1CF9000F007C117D /* Frameworks */,  
140 - 97C146EC1CF9000F007C117D /* Resources */,  
141 - 9705A1C41CF9048500538489 /* Embed Frameworks */,  
142 - 3B06AD1E1E4923F5004D2608 /* Thin Binary */,  
143 - );  
144 - buildRules = (  
145 - );  
146 - dependencies = (  
147 - );  
148 - name = Runner;  
149 - productName = Runner;  
150 - productReference = 97C146EE1CF9000F007C117D /* Runner.app */;  
151 - productType = "com.apple.product-type.application";  
152 - };  
153 -/* End PBXNativeTarget section */  
154 -  
155 -/* Begin PBXProject section */  
156 - 97C146E61CF9000F007C117D /* Project object */ = {  
157 - isa = PBXProject;  
158 - attributes = {  
159 - LastUpgradeCheck = 0910;  
160 - ORGANIZATIONNAME = "The Chromium Authors";  
161 - TargetAttributes = {  
162 - 97C146ED1CF9000F007C117D = {  
163 - CreatedOnToolsVersion = 7.3.1;  
164 - };  
165 - };  
166 - };  
167 - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;  
168 - compatibilityVersion = "Xcode 3.2";  
169 - developmentRegion = English;  
170 - hasScannedForEncodings = 0;  
171 - knownRegions = (  
172 - en,  
173 - Base,  
174 - );  
175 - mainGroup = 97C146E51CF9000F007C117D;  
176 - productRefGroup = 97C146EF1CF9000F007C117D /* Products */;  
177 - projectDirPath = "";  
178 - projectRoot = "";  
179 - targets = (  
180 - 97C146ED1CF9000F007C117D /* Runner */,  
181 - );  
182 - };  
183 -/* End PBXProject section */  
184 -  
185 -/* Begin PBXResourcesBuildPhase section */  
186 - 97C146EC1CF9000F007C117D /* Resources */ = {  
187 - isa = PBXResourcesBuildPhase;  
188 - buildActionMask = 2147483647;  
189 - files = (  
190 - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,  
191 - 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,  
192 - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,  
193 - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,  
194 - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,  
195 - 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,  
196 - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,  
197 - );  
198 - runOnlyForDeploymentPostprocessing = 0;  
199 - };  
200 -/* End PBXResourcesBuildPhase section */  
201 -  
202 -/* Begin PBXShellScriptBuildPhase section */  
203 - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {  
204 - isa = PBXShellScriptBuildPhase;  
205 - buildActionMask = 2147483647;  
206 - files = (  
207 - );  
208 - inputPaths = (  
209 - );  
210 - name = "Thin Binary";  
211 - outputPaths = (  
212 - );  
213 - runOnlyForDeploymentPostprocessing = 0;  
214 - shellPath = /bin/sh;  
215 - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";  
216 - };  
217 - 9740EEB61CF901F6004384FC /* Run Script */ = {  
218 - isa = PBXShellScriptBuildPhase;  
219 - buildActionMask = 2147483647;  
220 - files = (  
221 - );  
222 - inputPaths = (  
223 - );  
224 - name = "Run Script";  
225 - outputPaths = (  
226 - );  
227 - runOnlyForDeploymentPostprocessing = 0;  
228 - shellPath = /bin/sh;  
229 - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";  
230 - };  
231 -/* End PBXShellScriptBuildPhase section */  
232 -  
233 -/* Begin PBXSourcesBuildPhase section */  
234 - 97C146EA1CF9000F007C117D /* Sources */ = {  
235 - isa = PBXSourcesBuildPhase;  
236 - buildActionMask = 2147483647;  
237 - files = (  
238 - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,  
239 - 97C146F31CF9000F007C117D /* main.m in Sources */,  
240 - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,  
241 - );  
242 - runOnlyForDeploymentPostprocessing = 0;  
243 - };  
244 -/* End PBXSourcesBuildPhase section */  
245 -  
246 -/* Begin PBXVariantGroup section */  
247 - 97C146FA1CF9000F007C117D /* Main.storyboard */ = {  
248 - isa = PBXVariantGroup;  
249 - children = (  
250 - 97C146FB1CF9000F007C117D /* Base */,  
251 - );  
252 - name = Main.storyboard;  
253 - sourceTree = "<group>";  
254 - };  
255 - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {  
256 - isa = PBXVariantGroup;  
257 - children = (  
258 - 97C147001CF9000F007C117D /* Base */,  
259 - );  
260 - name = LaunchScreen.storyboard;  
261 - sourceTree = "<group>";  
262 - };  
263 -/* End PBXVariantGroup section */  
264 -  
265 -/* Begin XCBuildConfiguration section */  
266 - 97C147031CF9000F007C117D /* Debug */ = {  
267 - isa = XCBuildConfiguration;  
268 - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;  
269 - buildSettings = {  
270 - ALWAYS_SEARCH_USER_PATHS = NO;  
271 - CLANG_ANALYZER_NONNULL = YES;  
272 - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";  
273 - CLANG_CXX_LIBRARY = "libc++";  
274 - CLANG_ENABLE_MODULES = YES;  
275 - CLANG_ENABLE_OBJC_ARC = YES;  
276 - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;  
277 - CLANG_WARN_BOOL_CONVERSION = YES;  
278 - CLANG_WARN_COMMA = YES;  
279 - CLANG_WARN_CONSTANT_CONVERSION = YES;  
280 - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;  
281 - CLANG_WARN_EMPTY_BODY = YES;  
282 - CLANG_WARN_ENUM_CONVERSION = YES;  
283 - CLANG_WARN_INFINITE_RECURSION = YES;  
284 - CLANG_WARN_INT_CONVERSION = YES;  
285 - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;  
286 - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;  
287 - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;  
288 - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;  
289 - CLANG_WARN_STRICT_PROTOTYPES = YES;  
290 - CLANG_WARN_SUSPICIOUS_MOVE = YES;  
291 - CLANG_WARN_UNREACHABLE_CODE = YES;  
292 - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;  
293 - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";  
294 - COPY_PHASE_STRIP = NO;  
295 - DEBUG_INFORMATION_FORMAT = dwarf;  
296 - ENABLE_STRICT_OBJC_MSGSEND = YES;  
297 - ENABLE_TESTABILITY = YES;  
298 - GCC_C_LANGUAGE_STANDARD = gnu99;  
299 - GCC_DYNAMIC_NO_PIC = NO;  
300 - GCC_NO_COMMON_BLOCKS = YES;  
301 - GCC_OPTIMIZATION_LEVEL = 0;  
302 - GCC_PREPROCESSOR_DEFINITIONS = (  
303 - "DEBUG=1",  
304 - "$(inherited)",  
305 - );  
306 - GCC_WARN_64_TO_32_BIT_CONVERSION = YES;  
307 - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;  
308 - GCC_WARN_UNDECLARED_SELECTOR = YES;  
309 - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;  
310 - GCC_WARN_UNUSED_FUNCTION = YES;  
311 - GCC_WARN_UNUSED_VARIABLE = YES;  
312 - IPHONEOS_DEPLOYMENT_TARGET = 8.0;  
313 - MTL_ENABLE_DEBUG_INFO = YES;  
314 - ONLY_ACTIVE_ARCH = YES;  
315 - SDKROOT = iphoneos;  
316 - TARGETED_DEVICE_FAMILY = "1,2";  
317 - };  
318 - name = Debug;  
319 - };  
320 - 97C147041CF9000F007C117D /* Release */ = {  
321 - isa = XCBuildConfiguration;  
322 - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;  
323 - buildSettings = {  
324 - ALWAYS_SEARCH_USER_PATHS = NO;  
325 - CLANG_ANALYZER_NONNULL = YES;  
326 - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";  
327 - CLANG_CXX_LIBRARY = "libc++";  
328 - CLANG_ENABLE_MODULES = YES;  
329 - CLANG_ENABLE_OBJC_ARC = YES;  
330 - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;  
331 - CLANG_WARN_BOOL_CONVERSION = YES;  
332 - CLANG_WARN_COMMA = YES;  
333 - CLANG_WARN_CONSTANT_CONVERSION = YES;  
334 - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;  
335 - CLANG_WARN_EMPTY_BODY = YES;  
336 - CLANG_WARN_ENUM_CONVERSION = YES;  
337 - CLANG_WARN_INFINITE_RECURSION = YES;  
338 - CLANG_WARN_INT_CONVERSION = YES;  
339 - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;  
340 - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;  
341 - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;  
342 - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;  
343 - CLANG_WARN_STRICT_PROTOTYPES = YES;  
344 - CLANG_WARN_SUSPICIOUS_MOVE = YES;  
345 - CLANG_WARN_UNREACHABLE_CODE = YES;  
346 - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;  
347 - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";  
348 - COPY_PHASE_STRIP = NO;  
349 - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";  
350 - ENABLE_NS_ASSERTIONS = NO;  
351 - ENABLE_STRICT_OBJC_MSGSEND = YES;  
352 - GCC_C_LANGUAGE_STANDARD = gnu99;  
353 - GCC_NO_COMMON_BLOCKS = YES;  
354 - GCC_WARN_64_TO_32_BIT_CONVERSION = YES;  
355 - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;  
356 - GCC_WARN_UNDECLARED_SELECTOR = YES;  
357 - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;  
358 - GCC_WARN_UNUSED_FUNCTION = YES;  
359 - GCC_WARN_UNUSED_VARIABLE = YES;  
360 - IPHONEOS_DEPLOYMENT_TARGET = 8.0;  
361 - MTL_ENABLE_DEBUG_INFO = NO;  
362 - SDKROOT = iphoneos;  
363 - TARGETED_DEVICE_FAMILY = "1,2";  
364 - VALIDATE_PRODUCT = YES;  
365 - };  
366 - name = Release;  
367 - };  
368 - 97C147061CF9000F007C117D /* Debug */ = {  
369 - isa = XCBuildConfiguration;  
370 - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;  
371 - buildSettings = {  
372 - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;  
373 - CURRENT_PROJECT_VERSION = 1;  
374 - ENABLE_BITCODE = NO;  
375 - FRAMEWORK_SEARCH_PATHS = (  
376 - "$(inherited)",  
377 - "$(PROJECT_DIR)/Flutter",  
378 - );  
379 - INFOPLIST_FILE = Runner/Info.plist;  
380 - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";  
381 - LIBRARY_SEARCH_PATHS = (  
382 - "$(inherited)",  
383 - "$(PROJECT_DIR)/Flutter",  
384 - );  
385 - PRODUCT_BUNDLE_IDENTIFIER = de.udos.flutterStateManagement;  
386 - PRODUCT_NAME = "$(TARGET_NAME)";  
387 - VERSIONING_SYSTEM = "apple-generic";  
388 - };  
389 - name = Debug;  
390 - };  
391 - 97C147071CF9000F007C117D /* Release */ = {  
392 - isa = XCBuildConfiguration;  
393 - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;  
394 - buildSettings = {  
395 - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;  
396 - CURRENT_PROJECT_VERSION = 1;  
397 - ENABLE_BITCODE = NO;  
398 - FRAMEWORK_SEARCH_PATHS = (  
399 - "$(inherited)",  
400 - "$(PROJECT_DIR)/Flutter",  
401 - );  
402 - INFOPLIST_FILE = Runner/Info.plist;  
403 - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";  
404 - LIBRARY_SEARCH_PATHS = (  
405 - "$(inherited)",  
406 - "$(PROJECT_DIR)/Flutter",  
407 - );  
408 - PRODUCT_BUNDLE_IDENTIFIER = de.udos.flutterStateManagement;  
409 - PRODUCT_NAME = "$(TARGET_NAME)";  
410 - VERSIONING_SYSTEM = "apple-generic";  
411 - };  
412 - name = Release;  
413 - };  
414 -/* End XCBuildConfiguration section */  
415 -  
416 -/* Begin XCConfigurationList section */  
417 - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {  
418 - isa = XCConfigurationList;  
419 - buildConfigurations = (  
420 - 97C147031CF9000F007C117D /* Debug */,  
421 - 97C147041CF9000F007C117D /* Release */,  
422 - );  
423 - defaultConfigurationIsVisible = 0;  
424 - defaultConfigurationName = Release;  
425 - };  
426 - 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {  
427 - isa = XCConfigurationList;  
428 - buildConfigurations = (  
429 - 97C147061CF9000F007C117D /* Debug */,  
430 - 97C147071CF9000F007C117D /* Release */,  
431 - );  
432 - defaultConfigurationIsVisible = 0;  
433 - defaultConfigurationName = Release;  
434 - };  
435 -/* End XCConfigurationList section */  
436 - };  
437 - rootObject = 97C146E61CF9000F007C117D /* Project object */;  
438 -}  
1 -import 'package:benckmark/_bloc_lib/_shared/entitity.dart';  
2 -import 'package:benckmark/_bloc_lib/_shared/item.entity.dart';  
3 -  
4 -import 'items.events.dart';  
5 -import 'items.state.dart';  
6 -  
7 -class ItemsBloc extends EntityBloc<EntityEvent, ItemsState> {  
8 - @override  
9 - ItemsState get initialState => ItemsState(sampleItems);  
10 -  
11 - @override  
12 - Stream<ItemsState> mapEventToState(EntityEvent event) async* {  
13 - if (event is AddItemEvent) {  
14 - final List<Item> items = List.from(state.entities)..add(event.item);  
15 -  
16 - yield ItemsState(items);  
17 - } else if (event is AddItemsEvent) {  
18 - final List<Item> items = List.from(state.entities)..addAll(event.items);  
19 -  
20 - yield ItemsState(items);  
21 - } else if (event is RemoveItemsEvent) {  
22 - final List<Item> items = List.from(state.entities);  
23 -  
24 - items.removeWhere((item) => event.itemIds.contains(item.id));  
25 -  
26 - yield ItemsState(items);  
27 - }  
28 - }  
29 -}  
1 -import 'package:benckmark/_bloc_lib/_shared/entitity.dart';  
2 -import 'package:benckmark/_bloc_lib/_shared/item.entity.dart';  
3 -  
4 -class AddItemEvent extends EntityEvent<Item> {  
5 - final Item item;  
6 -  
7 - AddItemEvent(this.item);  
8 -  
9 - @override  
10 - List<Object> get props => [item];  
11 -}  
12 -  
13 -class AddItemsEvent extends EntityEvent<Item> {  
14 - final List<Item> items;  
15 -  
16 - AddItemsEvent(this.items);  
17 -  
18 - @override  
19 - List<Object> get props => [items];  
20 -}  
21 -  
22 -class RemoveItemsEvent extends EntityEvent<Item> {  
23 - final List<String> itemIds;  
24 -  
25 - RemoveItemsEvent(this.itemIds);  
26 -  
27 - @override  
28 - List<Object> get props => [itemIds];  
29 -}  
1 -import 'package:benckmark/_bloc_lib/_shared/entitity.dart';  
2 -import 'package:benckmark/_bloc_lib/_shared/item.entity.dart';  
3 -  
4 -class ItemsState extends EntityState<Item> {  
5 - ItemsState([List<Item> items = const []]) : super(items);  
6 -}  
1 -import 'package:bloc/bloc.dart';  
2 -import 'package:equatable/equatable.dart';  
3 -import 'package:meta/meta.dart';  
4 -import 'package:uuid/uuid.dart';  
5 -  
6 -@immutable  
7 -class Entity extends Equatable {  
8 - final String id;  
9 -  
10 - Entity([String id]) : this.id = id ?? Uuid().v4();  
11 -  
12 - @override  
13 - List<Object> get props => [id];  
14 -}  
15 -  
16 -@immutable  
17 -abstract class EntityEvent<E extends Entity> extends Equatable {}  
18 -  
19 -@immutable  
20 -class EntityState<E extends Entity> extends Equatable {  
21 - final Map<String, E> dictionary;  
22 - final List<String> ids;  
23 - final List<E> entities;  
24 -  
25 - EntityState([this.entities = const []])  
26 - : dictionary = Map.fromIterable(entities,  
27 - key: (entity) => entity.id, value: (entity) => entity),  
28 - ids = List.from(entities.map((entity) => entity.id));  
29 -  
30 - @override  
31 - List<Object> get props => [dictionary, ids, entities];  
32 -}  
33 -  
34 -abstract class EntityBloc<Event extends EntityEvent, State extends EntityState>  
35 - extends Bloc<Event, State> {}  
1 -import 'package:meta/meta.dart';  
2 -  
3 -import 'entitity.dart';  
4 -  
5 -@immutable  
6 -class Item extends Entity {  
7 - final String title;  
8 -  
9 - Item({String id, this.title}) : super();  
10 -  
11 - @override  
12 - List<Object> get props => super.props..addAll([id, title]);  
13 -}  
14 -  
15 -final List<Item> sampleItems = [  
16 - Item(title: 'Item 1'),  
17 - Item(title: 'Item 2'),  
18 - Item(title: 'Item 3')  
19 -];  
1 -import 'package:flutter/material.dart';  
2 -import 'package:flutter_bloc/flutter_bloc.dart';  
3 -import 'package:benckmark/_bloc_lib/_blocs/items/items.bloc.dart';  
4 -import 'package:benckmark/_bloc_lib/_blocs/items/items.events.dart';  
5 -import 'package:benckmark/_bloc_lib/_blocs/items/items.state.dart';  
6 -import 'package:benckmark/_bloc_lib/_shared/item.entity.dart';  
7 -  
8 -class App extends StatelessWidget {  
9 - Widget build(BuildContext context) {  
10 - return MultiBlocProvider(  
11 - providers: [  
12 - BlocProvider<ItemsBloc>(  
13 - create: (context) => ItemsBloc(),  
14 - ),  
15 - ],  
16 - child: MaterialApp(  
17 - title: 'BLoC Lib Sample',  
18 - theme: ThemeData(  
19 - primarySwatch: Colors.blue,  
20 - ),  
21 - home: Page(  
22 - title: 'BLoC Lib Sample',  
23 - ),  
24 - ),  
25 - );  
26 - }  
27 -}  
28 -  
29 -class Page extends StatefulWidget {  
30 - Page({  
31 - Key key,  
32 - this.title,  
33 - }) : super(key: key);  
34 -  
35 - final String title;  
36 -  
37 - @override  
38 - _PageState createState() => _PageState();  
39 -}  
40 -  
41 -class _PageState extends State<Page> {  
42 - @override  
43 - void initState() {  
44 - fill();  
45 - super.initState();  
46 - }  
47 -  
48 - fill() async {  
49 - for (int i = 0; i < 10; i++) {  
50 - await Future.delayed(Duration(milliseconds: 500));  
51 - BlocProvider.of<ItemsBloc>(context)  
52 - .add(AddItemEvent(Item(title: DateTime.now().toString())));  
53 - }  
54 - print("It's done. Print now!");  
55 - }  
56 -  
57 - @override  
58 - Widget build(BuildContext context) {  
59 - return Scaffold(  
60 - appBar: AppBar(  
61 - title: Text(widget.title),  
62 - ),  
63 - body: ListViewWidget(),  
64 - );  
65 - }  
66 -}  
67 -  
68 -class ListViewWidget extends StatelessWidget {  
69 - @override  
70 - Widget build(BuildContext context) {  
71 - // ignore: close_sinks  
72 - final _itemsBloc = BlocProvider.of<ItemsBloc>(context);  
73 -  
74 - return BlocBuilder<ItemsBloc, ItemsState>(  
75 - bloc: _itemsBloc,  
76 - builder: (context, entityState) {  
77 - return ListView.builder(  
78 - padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0),  
79 - itemCount: entityState.entities.length,  
80 - itemBuilder: (context, index) {  
81 - final item = entityState.entities[index];  
82 -  
83 - return ListTile(  
84 - title: Text(item.title),  
85 - );  
86 - },  
87 - );  
88 - },  
89 - );  
90 - }  
91 -}  
  1 +# Miscellaneous
  2 +*.class
  3 +*.log
  4 +*.pyc
  5 +*.swp
  6 +.DS_Store
  7 +.atom/
  8 +.buildlog/
  9 +.history
  10 +.svn/
  11 +
  12 +# IntelliJ related
  13 +*.iml
  14 +*.ipr
  15 +*.iws
  16 +.idea/
  17 +
  18 +# The .vscode folder contains launch configuration and tasks you configure in
  19 +# VS Code which you may wish to be included in version control, so this line
  20 +# is commented out by default.
  21 +#.vscode/
  22 +
  23 +# Flutter/Dart/Pub related
  24 +**/doc/api/
  25 +**/ios/Flutter/.last_build_id
  26 +.dart_tool/
  27 +.flutter-plugins
  28 +.flutter-plugins-dependencies
  29 +.packages
  30 +.pub-cache/
  31 +.pub/
  32 +/build/
  33 +
  34 +# Web related
  35 +lib/generated_plugin_registrant.dart
  36 +
  37 +# Symbolication related
  38 +app.*.symbols
  39 +
  40 +# Obfuscation related
  41 +app.*.map.json
  42 +
  43 +# Exceptions to above rules.
  44 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
  1 +# Flutter State Management
  1 +import 'dart:async';
  2 +
  3 +import 'package:bloc/bloc.dart';
  4 +import 'package:benckmark/item.dart';
  5 +
  6 +part 'items_event.dart';
  7 +
  8 +class ItemsBloc extends Bloc<ItemsEvent, List<Item>> {
  9 + ItemsBloc() {
  10 + Timer.periodic(const Duration(milliseconds: 500), (timer) {
  11 + add(AddItemEvent(Item(title: DateTime.now().toString())));
  12 + if (state.length == 10) {
  13 + timer.cancel();
  14 + print("It's done. Print now!");
  15 + }
  16 + });
  17 + }
  18 +
  19 + @override
  20 + List<Item> get initialState => sampleItems;
  21 +
  22 + @override
  23 + Stream<List<Item>> mapEventToState(ItemsEvent event) async* {
  24 + if (event is AddItemEvent) {
  25 + yield List.from(state)..add(event.item);
  26 + }
  27 + }
  28 +}
  1 +part of 'items_bloc.dart';
  2 +
  3 +abstract class ItemsEvent {}
  4 +
  5 +class AddItemEvent extends ItemsEvent {
  6 + AddItemEvent(this.item);
  7 +
  8 + final Item item;
  9 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_bloc/flutter_bloc.dart';
  3 +import 'package:benckmark/item.dart';
  4 +import 'package:benckmark/_bloc_lib/_blocs/items/items_bloc.dart';
  5 +
  6 +class App extends StatelessWidget {
  7 + Widget build(BuildContext context) {
  8 + return MaterialApp(
  9 + title: 'BLoC Lib Sample',
  10 + theme: ThemeData(primarySwatch: Colors.blue),
  11 + home: BlocProvider(
  12 + create: (_) => ItemsBloc(),
  13 + child: Page(title: 'BLoC Lib Sample'),
  14 + ),
  15 + );
  16 + }
  17 +}
  18 +
  19 +class Page extends StatelessWidget {
  20 + const Page({Key key, this.title}) : super(key: key);
  21 +
  22 + final String title;
  23 +
  24 + @override
  25 + Widget build(BuildContext context) {
  26 + return Scaffold(
  27 + appBar: AppBar(title: Text(title)),
  28 + body: BlocBuilder<ItemsBloc, List<Item>>(
  29 + builder: (context, items) {
  30 + return ListView.builder(
  31 + padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0),
  32 + itemCount: items.length,
  33 + itemBuilder: (context, index) {
  34 + return ListTile(title: Text(items[index].title));
  35 + },
  36 + );
  37 + },
  38 + ),
  39 + );
  40 + }
  41 +}
@@ -2,6 +2,9 @@ import 'package:benckmark/item.dart'; @@ -2,6 +2,9 @@ import 'package:benckmark/item.dart';
2 import 'package:get/get.dart'; 2 import 'package:get/get.dart';
3 3
4 class Controller extends RxController { 4 class Controller extends RxController {
  5 + Controller() {
  6 + onInit();
  7 + }
5 final items = sampleItems.obs; 8 final items = sampleItems.obs;
6 9
7 @override 10 @override
@@ -15,9 +15,7 @@ class App extends StatelessWidget { @@ -15,9 +15,7 @@ class App extends StatelessWidget {
15 } 15 }
16 } 16 }
17 17
18 -Controller c = Controller();  
19 -  
20 -class Page extends StatefulWidget { 18 +class Page extends StatelessWidget {
21 Page({ 19 Page({
22 Key key, 20 Key key,
23 this.title, 21 this.title,
@@ -26,21 +24,10 @@ class Page extends StatefulWidget { @@ -26,21 +24,10 @@ class Page extends StatefulWidget {
26 final String title; 24 final String title;
27 25
28 @override 26 @override
29 - _PageState createState() => _PageState();  
30 -}  
31 -  
32 -class _PageState extends State<Page> {  
33 - @override  
34 - void initState() {  
35 - c.onInit();  
36 - super.initState();  
37 - }  
38 -  
39 - @override  
40 Widget build(BuildContext context) { 27 Widget build(BuildContext context) {
41 return Scaffold( 28 return Scaffold(
42 appBar: AppBar( 29 appBar: AppBar(
43 - title: Text(widget.title), 30 + title: Text("GetX"),
44 ), 31 ),
45 body: ListViewWidget(), 32 body: ListViewWidget(),
46 ); 33 );
@@ -48,6 +35,7 @@ class _PageState extends State<Page> { @@ -48,6 +35,7 @@ class _PageState extends State<Page> {
48 } 35 }
49 36
50 class ListViewWidget extends StatelessWidget { 37 class ListViewWidget extends StatelessWidget {
  38 + final Controller c = Controller();
51 @override 39 @override
52 Widget build(BuildContext context) { 40 Widget build(BuildContext context) {
53 return Obxx(() => ListView.builder( 41 return Obxx(() => ListView.builder(
1 import 'package:flutter/foundation.dart'; 1 import 'package:flutter/foundation.dart';
2 import 'package:benckmark/item.dart'; 2 import 'package:benckmark/item.dart';
  3 +import 'package:flutter/scheduler.dart';
3 4
4 class AppState with ChangeNotifier { 5 class AppState with ChangeNotifier {
  6 + AppState() {
  7 + SchedulerBinding.instance.addPostFrameCallback((timeStamp) async {
  8 + for (int i = 0; i < 10; i++) {
  9 + await Future.delayed(Duration(milliseconds: 500));
  10 + addItem(Item(title: DateTime.now().toString()));
  11 + }
  12 + print("It's done. Print now!");
  13 + });
  14 + }
  15 +
5 List<Item> _items = sampleItems; 16 List<Item> _items = sampleItems;
6 17
7 List<Item> get items => _items; 18 List<Item> get items => _items;
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 -import 'package:flutter/scheduler.dart';  
3 -import 'package:benckmark/item.dart';  
4 import 'package:provider/provider.dart'; 2 import 'package:provider/provider.dart';
5 3
6 import '_state.dart'; 4 import '_state.dart';
@@ -21,7 +19,7 @@ class App extends StatelessWidget { @@ -21,7 +19,7 @@ class App extends StatelessWidget {
21 } 19 }
22 } 20 }
23 21
24 -class Page extends StatefulWidget { 22 +class Page extends StatelessWidget {
25 Page({ 23 Page({
26 Key key, 24 Key key,
27 this.title, 25 this.title,
@@ -30,28 +28,10 @@ class Page extends StatefulWidget { @@ -30,28 +28,10 @@ class Page extends StatefulWidget {
30 final String title; 28 final String title;
31 29
32 @override 30 @override
33 - _PageState createState() => _PageState();  
34 -}  
35 -  
36 -class _PageState extends State<Page> {  
37 - @override  
38 - void initState() {  
39 - SchedulerBinding.instance.addPostFrameCallback((timeStamp) async {  
40 - for (int i = 0; i < 10; i++) {  
41 - await Future.delayed(Duration(milliseconds: 500));  
42 - final state = Provider.of<AppState>(context, listen: false);  
43 - state.addItem(Item(title: DateTime.now().toString()));  
44 - }  
45 - print("It's done. Print now!");  
46 - });  
47 - super.initState();  
48 - }  
49 -  
50 - @override  
51 Widget build(BuildContext context) { 31 Widget build(BuildContext context) {
52 return Scaffold( 32 return Scaffold(
53 appBar: AppBar( 33 appBar: AppBar(
54 - title: Text(widget.title), 34 + title: Text(title),
55 ), 35 ),
56 body: ListViewWidget(), 36 body: ListViewWidget(),
57 ); 37 );
@@ -61,8 +41,8 @@ class _PageState extends State<Page> { @@ -61,8 +41,8 @@ class _PageState extends State<Page> {
61 class ListViewWidget extends StatelessWidget { 41 class ListViewWidget extends StatelessWidget {
62 @override 42 @override
63 Widget build(BuildContext context) { 43 Widget build(BuildContext context) {
64 - return Consumer<AppState>(  
65 - builder: (context, state, child) { 44 + final state = context.watch<AppState>();
  45 +
66 return ListView.builder( 46 return ListView.builder(
67 padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0), 47 padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0),
68 itemCount: state.items.length, 48 itemCount: state.items.length,
@@ -72,7 +52,5 @@ class ListViewWidget extends StatelessWidget { @@ -72,7 +52,5 @@ class ListViewWidget extends StatelessWidget {
72 ); 52 );
73 }, 53 },
74 ); 54 );
75 - },  
76 - );  
77 } 55 }
78 } 56 }
1 -import 'package:flutter/material.dart'; 1 +import 'package:flutter/widgets.dart';
2 2
3 -import 'package:benckmark/_bloc_plain/app.dart'; 3 +//import 'package:benckmark/_bloc_plain/app.dart';
4 //import 'package:benckmark/_bloc_lib/app.dart'; 4 //import 'package:benckmark/_bloc_lib/app.dart';
5 //import 'package:benckmark/_mobx/app.dart'; 5 //import 'package:benckmark/_mobx/app.dart';
6 //import 'package:benckmark/_redux/app.dart'; 6 //import 'package:benckmark/_redux/app.dart';
7 //import 'package:benckmark/_get_rx/app.dart'; 7 //import 'package:benckmark/_get_rx/app.dart';
8 8
9 //import 'package:benckmark/_provider/app.dart'; 9 //import 'package:benckmark/_provider/app.dart';
10 -//import 'package:benckmark/_get/app.dart'; 10 +import 'package:benckmark/_get/app.dart';
11 11
12 void main() => runApp(App()); 12 void main() => runApp(App());
@@ -201,7 +201,7 @@ packages: @@ -201,7 +201,7 @@ packages:
201 name: flutter_bloc 201 name: flutter_bloc
202 url: "https://pub.dartlang.org" 202 url: "https://pub.dartlang.org"
203 source: hosted 203 source: hosted
204 - version: "4.0.0" 204 + version: "4.0.1"
205 flutter_mobx: 205 flutter_mobx:
206 dependency: "direct main" 206 dependency: "direct main"
207 description: 207 description:
@@ -227,7 +227,7 @@ packages: @@ -227,7 +227,7 @@ packages:
227 name: get 227 name: get
228 url: "https://pub.dartlang.org" 228 url: "https://pub.dartlang.org"
229 source: hosted 229 source: hosted
230 - version: "2.12.4" 230 + version: "2.12.5-beta"
231 glob: 231 glob:
232 dependency: transitive 232 dependency: transitive
233 description: 233 description:
@@ -417,13 +417,6 @@ packages: @@ -417,13 +417,6 @@ packages:
417 url: "https://pub.dartlang.org" 417 url: "https://pub.dartlang.org"
418 source: hosted 418 source: hosted
419 version: "0.23.1" 419 version: "0.23.1"
420 - scoped_model:  
421 - dependency: "direct main"  
422 - description:  
423 - name: scoped_model  
424 - url: "https://pub.dartlang.org"  
425 - source: hosted  
426 - version: "1.0.1"  
427 shelf: 420 shelf:
428 dependency: transitive 421 dependency: transitive
429 description: 422 description:
@@ -519,7 +512,7 @@ packages: @@ -519,7 +512,7 @@ packages:
519 name: uuid 512 name: uuid
520 url: "https://pub.dartlang.org" 513 url: "https://pub.dartlang.org"
521 source: hosted 514 source: hosted
522 - version: "2.0.4" 515 + version: "2.1.0"
523 vector_math: 516 vector_math:
524 dependency: transitive 517 dependency: transitive
525 description: 518 description:
@@ -549,5 +542,5 @@ packages: @@ -549,5 +542,5 @@ packages:
549 source: hosted 542 source: hosted
550 version: "2.2.1" 543 version: "2.2.1"
551 sdks: 544 sdks:
552 - dart: ">=2.7.0 <3.0.0" 545 + dart: ">=2.9.0-14.0.dev <3.0.0"
553 flutter: ">=1.16.0" 546 flutter: ">=1.16.0"
@@ -5,7 +5,7 @@ dependencies: @@ -5,7 +5,7 @@ dependencies:
5 flutter: 5 flutter:
6 sdk: flutter 6 sdk: flutter
7 cupertino_icons: ^0.1.2 7 cupertino_icons: ^0.1.2
8 - get: ^2.12.4 8 + get: 2.12.5-beta
9 bloc: ^4.0.0 9 bloc: ^4.0.0
10 equatable: ^1.0.2 10 equatable: ^1.0.2
11 flutter_bloc: ^4.0.0 11 flutter_bloc: ^4.0.0
  1 +// This is a basic Flutter widget test.
  2 +// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
  3 +// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
  4 +// find child widgets in the widget tree, read text, and verify that the values of widget properties
  5 +// are correct.
  6 +
  7 +import 'package:flutter/material.dart';
  8 +import 'package:benckmark/_redux/app.dart';
  9 +import 'package:flutter_test/flutter_test.dart';
  10 +
  11 +void main() {
  12 + testWidgets('Counter increments smoke test', (WidgetTester tester) async {
  13 + // Build our app and trigger a frame.
  14 + await tester.pumpWidget(App());
  15 +
  16 + // Verify that our counter starts at 0.
  17 + expect(find.text('0'), findsOneWidget);
  18 + expect(find.text('1'), findsNothing);
  19 +
  20 + // Tap the '+' icon and trigger a frame.
  21 + await tester.tap(find.byIcon(Icons.add));
  22 + await tester.pump();
  23 +
  24 + // Verify that our counter has incremented.
  25 + expect(find.text('0'), findsNothing);
  26 + expect(find.text('1'), findsOneWidget);
  27 + });
  28 +}
1 -// // This is a basic Flutter widget test.  
2 -// // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter  
3 -// // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to  
4 -// // find child widgets in the widget tree, read text, and verify that the values of widget properties  
5 -// // are correct.  
6 -  
7 -// import 'package:flutter/material.dart';  
8 -// import 'package:benckmark/_redux/app.dart';  
9 -// import 'package:flutter_test/flutter_test.dart';  
10 -  
11 -// void main() {  
12 -// testWidgets('Counter increments smoke test', (WidgetTester tester) async {  
13 -// // Build our app and trigger a frame.  
14 -// await tester.pumpWidget(App());  
15 -  
16 -// // Verify that our counter starts at 0.  
17 -// expect(find.text('0'), findsOneWidget);  
18 -// expect(find.text('1'), findsNothing);  
19 -  
20 -// // Tap the '+' icon and trigger a frame.  
21 -// await tester.tap(find.byIcon(Icons.add));  
22 -// await tester.pump();  
23 -  
24 -// // Verify that our counter has incremented.  
25 -// expect(find.text('0'), findsNothing);  
26 -// expect(find.text('1'), findsOneWidget);  
27 -// });  
28 -// }