M-fikry / Errors-on-android-studio

0 stars 0 forks source link

The method 'initializedDatabase' was called on null. #1

Open M-fikry opened 5 years ago

M-fikry commented 5 years ago

I/flutter ( 2546): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ I/flutter ( 2546): The following NoSuchMethodError was thrown building studentList(dirty, state: studentState#a2897): I/flutter ( 2546): The method 'initializedDatabase' was called on null. I/flutter ( 2546): Receiver: null I/flutter ( 2546): Tried calling: initializedDatabase() I/flutter ( 2546): User-created ancestor of the error-causing widget was: I/flutter ( 2546): MaterialApp I/flutter ( 2546): file:///D:/F-MyProjects/00-Android/studentsControl/studentscontrolapp/lib/screens/main.dart:13:12 I/flutter ( 2546): When the exception was thrown, this was the stack: I/flutter ( 2546): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5) I/flutter ( 2546): #1 studentState.updateListView (package:studentscontrolapp/screens/StudentList.dart:116:40) I/flutter ( 2546): #2 studentState.build (package:studentscontrolapp/screens/StudentList.dart:29:9) I/flutter ( 2546): #3 StatefulElement.build (package:flutter/src/widgets/framework.dart:4047:27) I/flutter ( 2546): #4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3941:15) I/flutter ( 2546): #5 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #6 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #7 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #8 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #11 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #12 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #13 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #14 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #15 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #16 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #17 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #20 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #21 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #22 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #23 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #24 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #25 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #26 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #27 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #29 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #30 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #31 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #32 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #33 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #34 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #35 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #36 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #37 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #38 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #39 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #40 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #41 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #42 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #43 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #44 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #45 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #46 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #47 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #48 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #49 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #50 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #51 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #52 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #53 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #54 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #55 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #56 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #57 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #58 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #59 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #60 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #61 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #62 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #63 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #64 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #65 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #66 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #67 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #68 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #69 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #70 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #71 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #72 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #73 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #74 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #75 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #76 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #77 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #78 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #79 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #80 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #81 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #82 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #83 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #84 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #85 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #86 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #87 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #88 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #89 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #90 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #91 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #92 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #93 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #94 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #95 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #96 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #97 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #98 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #99 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5233:32) I/flutter ( 2546): #100 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #101 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #102 _TheatreElement.mount (package:flutter/src/widgets/overlay.dart:593:16) I/flutter ( 2546): #103 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #104 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #105 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #106 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #107 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #108 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #109 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #110 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #111 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #112 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #113 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #114 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #115 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #116 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #117 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #118 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #119 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #120 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #121 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #122 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #123 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #124 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #125 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #126 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #127 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #128 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #129 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #130 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #131 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #132 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #133 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #134 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #135 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #136 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #137 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #138 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #139 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #140 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #141 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #142 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #143 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #144 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #145 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #146 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #147 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #148 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #149 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #150 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #151 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #152 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #153 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #154 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #155 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #156 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #157 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #158 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #159 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #160 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #161 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #162 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #163 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #164 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #165 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #166 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #167 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #168 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #169 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #170 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #171 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #172 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #173 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #174 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #175 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #176 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #177 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #178 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #179 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #180 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #181 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #182 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #183 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #184 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #185 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #186 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #187 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #188 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #189 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #190 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #191 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #192 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #193 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #194 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #195 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #196 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #197 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #198 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #199 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #200 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #201 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #202 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #203 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #204 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #205 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #206 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #207 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #208 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #209 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #210 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #211 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #212 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #213 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #214 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #215 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #216 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #217 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #218 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #219 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #220 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14) I/flutter ( 2546): #221 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #222 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #223 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #224 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #225 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #226 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #227 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #228 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #229 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #230 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #231 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #232 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #233 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #234 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #235 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #236 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #237 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #238 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #239 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #240 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #241 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #242 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #243 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #244 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #245 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #246 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #247 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #248 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #249 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #250 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #251 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #252 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #253 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #254 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #255 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #256 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #257 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #258 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11) I/flutter ( 2546): #259 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #260 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #261 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #262 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) I/flutter ( 2546): #263 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) I/flutter ( 2546): #264 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5) I/flutter ( 2546): #265 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5) I/flutter ( 2546): #266 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14) I/flutter ( 2546): #267 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12) I/flutter ( 2546): #268 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:998:16) I/flutter ( 2546): #269 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:969:5) I/flutter ( 2546): #270 RenderObjectToWidgetAdapter.attachToRenderTree. (package:flutter/src/widgets/binding.dart:915:17) I/flutter ( 2546): #271 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2328:19) I/flutter ( 2546): #272 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:914:13) I/flutter ( 2546): #273 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:795:7) I/flutter ( 2546): #274 runApp (package:flutter/src/widgets/binding.dart:845:7) I/flutter ( 2546): #275 main (package:studentscontrolapp/screens/main.dart:7:3) I/flutter ( 2546): #276 _runMainZoned.. (dart:ui/hooks.dart:229:25) I/flutter ( 2546): #281 _runMainZoned. (dart:ui/hooks.dart:221:5) I/flutter ( 2546): #282 _startIsolate. (dart:isolate-patch/isolate_patch.dart:305:19) I/flutter ( 2546): #283 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12) I/flutter ( 2546): (elided 4 frames from package dart:async) I/flutter ( 2546): ════════════════════════════════════════════════════════════════════════════════════════════════════ HERE IS THE CODE

import 'package:flutter/material.dart'; import 'package:studentscontrolapp/models/student.dart'; import 'package:studentscontrolapp/screens/student_details.dart'; import 'dart:async'; import 'package:studentscontrolapp/utilities/sql_helper.dart'; import 'package:sqflite/sqflite.dart';

class StudentList extends StatefulWidget{

@override State createState() { // TODO: implement createState return StudentState(); } } class StudentState extends State{

SqlHelper helper = new SqlHelper(); List studentList;

int count=0; @override Widget build(BuildContext context) {

if(studentList == null){
    studentList = new List<Student>();
    updateListView();
}
// TODO: implement build
return Scaffold(
  appBar: AppBar(
    title: Text(
      "Students List"
    ),
  ),
  floatingActionButton: FloatingActionButton(
    onPressed: (){
     goToDetails(Student('','',0,''),"Adding New Student");
    },tooltip: "Add New",
    child: Icon(Icons.add),
  ),
  body: getStudentsList(),
);

} ListView getStudentsList(){ return ListView.builder( itemCount: count, itemBuilder: (BuildContext context,int position){ return Card( color: Colors.white, elevation: 0.2, child: ListTile( leading: CircleAvatar( backgroundColor: passed(this.studentList[position].success), child: getIcon(this.studentList[position].success), ), title: Text(this.studentList[position].stuName), subtitle: Text(this.studentList[position].describtion +" | "+ this.studentList[position].date), trailing: GestureDetector( child: Icon(Icons.delete,color: Colors.grey,), onTap: (){ _delete(context,this.studentList[position]); },), onTap: (){ goToDetails(this.studentList[position],"Editing Student"); }, ), ); }); } void goToDetails(Student student,String appTitle) async{ bool result = await Navigator.push(context,MaterialPageRoute(builder: (context){ return studentDetails(student,appTitle); })); if(result){ updateListView(); } } Color passed (int value){ switch(value){ case 0: return Colors.redAccent; break; case 1: return Colors.green; break; default: return Colors.white; break; } } Icon getIcon(int value){ switch(value){ case 0: return Icon(Icons.close); break; case 1: return Icon(Icons.check);

    break;
  default:
    return Icon(Icons.edit);

    break;
}

} void _showSnackBar(BuildContext context,String snackBarMsg){ final snackBar = SnackBar(content:Text(snackBarMsg),); Scaffold.of(context).showSnackBar(snackBar); } void updateListView(){ final Future db = helper.initializedDatabase(); db.then((database){ Future<List> students = helper.getStudentList(); students.then((theList){ setState(() { this.studentList = theList; this.count = theList.length; }); }); }); } void _delete(BuildContext context,Student student) async{ int result = await helper.deleteStudent(student.id); if(result != 0){ _showSnackBar(context, "Student Deleted"); } } }

M-fikry commented 5 years ago

any help will be appreciated