triple_pattern icon indicating copy to clipboard operation
triple_pattern copied to clipboard

Hot reload not working with TripleBuilder

Open phcs971 opened this issue 2 years ago • 2 comments

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

phcs971 avatar Aug 10 '23 17:08 phcs971

Same here

GustavoFigueira avatar Dec 29 '23 03:12 GustavoFigueira