0

I need to save an object in one page and then access, edit and again save it in other pages in Flutter.
Is there any way other than serialization and shared preferences?
How can I do that by using a static variable common to all pages?
Thanks in advance

Mohsen Emami
  • 2,709
  • 3
  • 33
  • 40

1 Answers1

2

There are several methods to do this.

  1. You could use a singleton to store your data:
    How do you build a Singleton in Dart?
    (Fast and ugly solution)

  2. You could implement the Bloc Pattern to State Management
    https://medium.com/flutterpub/architecting-your-flutter-project-bd04e144a8f1

  3. You could use any other State Management solution
    https://flutter.dev/docs/development/data-and-backend/state-mgmt/options

LgFranco
  • 1,004
  • 6
  • 14