Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

how to listen to similar stores with different arguments  #39

Description

@lzh77

There are some tab pages like fragment on android, I use constructor arguments to conotrol their stores. Like this:

List<GankPage> pages = [
  TabPage('aaa'),
  TabPage('bbb'),
]

class TabPage extends StoreWatcher {
  String type;
  StoreToken pageStoreToken;
  TabPage({Key k, this.type}) : super(key: k);

  @override
  void initStores(ListenToStore listenToStore) {
    pageStoreToken = StoreToken(PageStore(this.type));
    listenToStore(pageStoreToken);
    pageAction.call();
  }

}

If I write like this, when I switch tab the old actions will be called.
I saw the note is that stores should not depend on any constructor parameters.
Any suggetions?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions