rrousselGit / provider

InheritedWidgets, but simple
https://pub.dev/packages/provider
MIT License
5.1k stars 509 forks source link

DevTools extension are not buildable with latest Flutter/Dart #882

Open Sameri11 opened 1 month ago

Sameri11 commented 1 month ago

Describe the bug Hi!

I was interested in proceeding work on #868 to improve DevTools extension.

Here is my dev environment:

OS: macOS 14.3.1
Flutter: 3.22.2
Dart: 3.4.3
DevTools: 2.34.3

Dependencies of extension (which are rapidly developing as I see) needed to be updated because:

  1. vm_service version range is too restrictive and dependency resolution failed:
    Because every version of integration_test from sdk depends on vm_service 14.2.1 and provider_devtools_extension depends on vm_service >=11.9.0 <14.0.0, integration_test from sdk is forbidden.
    So, because provider_devtools_extension depends on integration_test from sdk, version solving failed.
  2. devtools_app_shared is outdated a bit and breaks tests. (Link)

...And couple other issues I experienced during updating:

  1. Seems like this deprecation broke somehow backward compatibility and now it's plugin's responsibility to check connection, at least in "development" (with simulated_chrome_environment option)

I will provide my fork with all these updates a little bit later in this issue since it's kinda horrible at the moment and can not be merged in any way. But it could be handy with reproducing next issue, which is most problematic I think.

Because of obligatory update of vm_service to 14.2.1 and up, core logic of instance_providers.dart breaks with a lot of null-related issues (because there is a lot of force-unwraps). If comment all _parseFields and just use empty lists, there are no exceptions. But no useful info in devtools too, of course, since no fields obtained from VM.

To Reproduce

  1. Clone my fork on branch null-exceptions, Link
  2. Run example app (provider/packages/provider/example). You will get log like this:
    ...
    A Dart VM Service on Chrome is available at: http://127.0.0.1:53606/jatJWHd2X30=
    The Flutter DevTools debugger and profiler on Chrome is available at:
    http://127.0.0.1:9101?uri=http://127.0.0.1:53606/jatJWHd2X30=
    ...

Obtain VM address from this log (in this case – http://127.0.0.1:53606/jatJWHd2X30=)

  1. Run extension example with --dart-define=use_simulated_environment=true as described here
  2. Connect to Dart VM from step 2 in upper-right corner (Dart VM service connection)
  3. Check error in Logs tab

Expected behavior

I was expecting instance_providers.dart to work with updated vm_service and updated VM service protocol