o1298098 / Flutter-Movie

😎 🎬 A Flutter movie app build with Fish-Redux and The Movie DB api.
Apache License 2.0
725 stars 219 forks source link

State Framework similar to Fish #52

Open henry-hz opened 3 years ago

henry-hz commented 3 years ago

Dear @o1298098 , I would like to ask you about fish-redux. I feel that their maintenance is very slow, and almost no feedback about the null safety issues posted there.

regards hh

o1298098 commented 3 years ago

Dear @o1298098 , I would like to ask you about fish-redux. I feel that their maintenance is very slow, and almost no feedback about the null safety issues posted there.

  • do you think that fish-redux is being abandoned ?

In the past six months, fish-redux has not supported null safety, and it has not been updated for a long time. I think fish-redux should be abandoned.

  • what do you think about an idea: to use https://pub.dev/packages/event_bus and manage the state in the same way fish redux is managing, keeping the state, effect, action pattern, but using the bus to send back and forward the communication between the state and view ?
  • what is your opinion about riverpod as a possible candidate to change fish-redux ?

I prefer to use Mobx combined Provider for state management.

henry-hz commented 3 years ago

@o1298098 I am adapting this approach: https://medium.com/flutter-community/flutter-state-management-for-minimalists-4c71a2f2f0c1 to be used in an almost identical approach used by fish, but.... without any framework, super clean, O(1) performance, only using plain dart. This is my first scratch: https://github.com/insurdao/flutter-boilerplate [still changing to use immutable state]

For the action, only this class is needed:

class Action {
  const Action(this.type, {this.payload});
  final Object type;
  final dynamic payload;
}

this is how the action.dart looks like

import 'package:insurdao/config/base.dart';

enum MainAction { action, loading, tabChanged, jumpToPage, pendingConversations}

loading(bool loading) {
  return Action(MainAction.loading, payload: loading);
}

onTabChanged(int index) {
  return Action(MainAction.tabChanged, payload: index);
}

onJumpToPage(int index) {
  return Action(MainAction.jumpToPage, payload: index);
}

onPendingConversations(int pending) {
  return Action(MainAction.pendingConversations, payload: pending);
}