Dart syntax - initSate,Build,deactive, Dispose
☝initSate(){ super.initSate //放置一旦載入statefulwidget後就不需一直更新的物件。}
如字面的意思in it sate. 此功能好比statefulwidget 裡面的statelesswidget。 Called only once when the widget is created,只會執行一次,不像build() 一變動就自毀後重建。
☝Build(BuildContext context) {//放置載入後每次有任何變動就需更新的物件。}
-Build the widget tree
-A build is triggred every time we use setState() that re-triggre build().
☝deactive() {super.deactive //放置當statefulwight自毀換頁前跟著毀的物件。例如:釋放記憶空間。}
☝Dispose()
- When the widget/state object is removed.
Comments
Post a Comment