provider: ^4.0.0 Flutter Performance refreshing

Created on 25 Dec 2019  ·  12Comments  ·  Source: rrousselGit/provider

After upgrading provider ^ 4.0.0, Flutter Performance keeps refreshing even without any operation.

Most helpful comment

Ah that's actually a misuse of SchedulerBinding to infer if the listen flag of Provider.of

It's actually a fairly critical bug, and I'll have to disable that inference and make a hot-fix

All 12 comments

I also confirmed this problem.
It is reproduced at https://github.com/rrousselGit/provider/tree/master/packages/provider/example, and I suspect that all applications which uses provider 4.0.0 are affected this problem.

There were no problems at version 3.2.0:
https://github.com/rrousselGit/provider/tree/v3.2.0/packages/provider/example

What are you talking about by performance keepks refreshing?

@rrousselGit

This refreshing started moving after upgrading to 4.0.0 on my project and example.

a

您在谈论什么让性能刷新呢?

ChangeNotifierProvider.value(
      value: value,
      child: Consumer(
        builder: (BuildContext context, S data, Widget child) {
          return Container();
        },
      ),
    )

I just added this code and did nothing.

I also confirmed this.

Even with this simple code

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        StreamProvider<String>.value(
          value: Stream.empty(),
        ),
      ],
      child: MaterialApp(
        title: '',
        home: Container(),
      ),
    );
  }
}

Crazy high cpu usage by iOS Simulator.

ss

Ah that's actually a misuse of SchedulerBinding to infer if the listen flag of Provider.of

It's actually a fairly critical bug, and I'll have to disable that inference and make a hot-fix

I still have this issue after changing the .yaml file to 'provider: ^4.0.0-hotfix.1' , is this the proper way to get the updates?

Make sure you ran pub get and that the lock file correctly says it uses the hot fix version

Make sure you ran pub get and that the lock file correctly says it uses the hot fix version

it worked, many thx

@pqsky7

I still have this issue after changing the .yaml file to 'provider: ^4.0.0-hotfix.1' , is this the proper way to get the updates?

Something like this should work. Once the newest version is released you can remove the overrides.

dependencies:
  provider: ^4.0.0

dependency_overrides:
  provider: 4.0.0-hotfix.1

A 4.0.1 is coming in a matter of minutes.

Which means ^4.0.0 will properly get the new version

Great thx - was hunting down the cause of this issue for last few days also. Really killed my dev env when running 2 emulators. Provider had always behaved so well before this. Great to have it back to normal again :-)

Was this page helpful?
0 / 5 - 0 ratings