Flutterando / triple_pattern

Segmented State Pattern for Reactive Property
MIT License
160 stars 36 forks source link

Hot reload not working with TripleBuilder #117

Open phcs971 opened 1 year ago

phcs971 commented 1 year ago

Describe the bug When developing and hot reloading the app changes inside the TripleBuilder does not change (the builder function is not called) until a state change (update, setLoading, setError) happen. I know it does not affect production code, once there is not hot reload in it, but it does make it harder to develop using TripleBuilder. ScopedBuilder works fine in hot reload.

Environment flutter_triple: 3.0.0

To Reproduce Run the following in dev mode, change anything inside the TripleBuilder and hot reload

class AppStore extends Store<int> {
  AppStore() : super(0);

  void increment() => update(state + 1);
}

class AppWidget extends StatefulWidget {
  const AppWidget({super.key});

  @override
  State<AppWidget> createState() => _AppWidgetState();
}

class _AppWidgetState extends State<AppWidget> {
  final store = AppStore();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: TripleBuilder(
        store: store,
        builder: (context, _) {
          return Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              // comment the first text, uncomment the second and hot reload
              Center(
                child: Text("Value: ${store.state}"),
                // child: Text("Reloaded value: ${store.state}"),
              ),
              const SizedBox(height: 12),
              ElevatedButton(
                onPressed: () => store.increment(),
                child: const Text("Increment"),
              ),
            ],
          );
        },
      ),
    );
  }
}

Expected behavior Hot reload runs the builder function again

GustavoFigueira commented 10 months ago

Same here

BrenoMFV commented 3 weeks ago

any update on this?