Closed tomriddle7 closed 2 years ago
I made memo app using two screen.
main.dart
floatingActionButton: FloatingActionButton( onPressed: Navigator.push( context, MaterialPageRoute(builder: (context) => WritePage()), ); }, tooltip: 'AddMemo', child: Icon(Icons.add), ),
WritePage.dart
_addItem() { setState(() { var memoList = storage.getItem('timeline_app'); MemoList list = new MemoList(); list.items = List<Memo>.from( (memoList as List).map( (item) => Memo( id: item['id'], title: item['title'], text: item['text'], createdTime: item['createdTime'], editedTime: item['editedTime'], done: item['done'], ), ), ); final item = new Memo( id: 0, title: this.title, text: this.text, createdTime: DateTime.now().toString(), editedTime: DateTime.now().toString(), done: false ); list.items.add(item); storage.setItem('timeline_app', list.toJSONEncodable()); Navigator.pop(context); }); }
When I create memo, it save to local storage but main screen is not change.
What problem in my code?
very hard to say what's wrong with your code based on example you've provided. Could you please create a minimalistic example repository demonstrating the issue?
I made memo app using two screen.
main.dart
WritePage.dart
When I create memo, it save to local storage but main screen is not change.
What problem in my code?