felangel / bloc

A predictable state management library that helps implement the BLoC design pattern

Home Page:https://bloclibrary.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docs: Can two hydratedBloc can overwrite each other if their method use same keys ?

Perry-chouteau opened this issue · comments

can bookState.status & movieState.status overwrite each other ?
It' s probably not the good place to ask question but can't find any place to. sorry & thanks for your help in advance.

factory BookState.fromMap(Map<String, dynamic> map) {
    return BookState(
        book: map[book],
        status: map['status']
    );
}

  Map<String, dynamic> toMap() {
    return {
      'book': book
      'status': status,
    };
}
factory MovieState.fromMap(Map<String, dynamic> map) {
    return MovieState(
        movie: map[movie],
        status: map['status']
    );
}

Map<String, dynamic> toMap() {
    return {
      'movie': movie
      'status': status,
    };
}

What do you mean by override and what are the types of status for BookState and MovieState?

Hi @Perry-chouteau, it won't override if BookState and MovieState are different bloc's state. Please feel free to post if u fell into any issue here or reach the bloc's discord since there are lot of good people to help :) Here's the Link https://discord.gg/bloc

What do you mean by override and what are the types of status for BookState and MovieState?

Thanks for your help, by "override" I wanna ask about storing data on phone using the same key with different values.

Edited using the same key, to store data on two different blocs.