Skip to content

fix: flutter web crashes when autoDispose used#1823

Merged
rrousselGit merged 4 commits into
rrousselGit:masterfrom
leehack:fix-auto-dispose-crash
Oct 27, 2022
Merged

fix: flutter web crashes when autoDispose used#1823
rrousselGit merged 4 commits into
rrousselGit:masterfrom
leehack:fix-auto-dispose-crash

Conversation

@leehack

@leehack leehack commented Oct 27, 2022

Copy link
Copy Markdown
Contributor

fixes #1713

With dart-lang/sdk#50119 (comment)
The dart compiler doesn't understand redefining class with mixin.

This fix can be a workaround until it's fixed from the dart side.

@RandalSchwartz

Copy link
Copy Markdown

It looks like this patch might be missing some of the _family items, just by looking at the list of filenames.
Maybe that should be double checked to prevent a surprise?

@rrousselGit

Copy link
Copy Markdown
Owner

It looks like this patch might be missing some of the _family items, just by looking at the list of filenames.
Maybe that should be double checked to prevent a surprise?

Not all providers have a _family file. :)

@rrousselGit

Copy link
Copy Markdown
Owner

@leehack Thanks! Lgtm!

@codecov

codecov Bot commented Oct 27, 2022

Copy link
Copy Markdown

Codecov Report

Merging #1823 (fd29a2b) into master (3247e3d) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1823      +/-   ##
==========================================
+ Coverage   95.15%   95.19%   +0.04%     
==========================================
  Files          49       49              
  Lines        1879     1895      +16     
==========================================
+ Hits         1788     1804      +16     
  Misses         91       91              
Impacted Files Coverage Δ
...lib/src/change_notifier_provider/auto_dispose.dart 100.00% <100.00%> (ø)
.../riverpod/lib/src/async_notifier/auto_dispose.dart 100.00% <100.00%> (ø)
...ges/riverpod/lib/src/framework/async_selector.dart 96.55% <100.00%> (+0.06%) ⬆️
packages/riverpod/lib/src/framework/selector.dart 92.15% <100.00%> (+0.15%) ⬆️
...riverpod/lib/src/future_provider/auto_dispose.dart 100.00% <100.00%> (ø)
...ckages/riverpod/lib/src/notifier/auto_dispose.dart 100.00% <100.00%> (ø)
...ckages/riverpod/lib/src/provider/auto_dispose.dart 100.00% <100.00%> (ø)
.../lib/src/state_notifier_provider/auto_dispose.dart 100.00% <100.00%> (ø)
.../riverpod/lib/src/state_provider/auto_dispose.dart 100.00% <100.00%> (ø)
...riverpod/lib/src/stream_provider/auto_dispose.dart 100.00% <100.00%> (ø)

@jeprojects

jeprojects commented Oct 29, 2022

Copy link
Copy Markdown

@rrousselGit Anyway to release the workaround version to pub.dev?

hooks_riverpod still depends on riverpod 2.02

UPDATE:

Overriding the dependencies works.

dependency_overrides:
  hooks_riverpod:
    git:
      url: https://github.com/rrousselGit/riverpod/
      ref: master
      path: packages/hooks_riverpod
  flutter_riverpod:
    git:
      url: https://github.com/rrousselGit/riverpod/
      ref: master
      path: packages/flutter_riverpod
  riverpod:
    git:
      url: https://github.com/rrousselGit/riverpod/
      ref: master
      path: packages/riverpod

@AdrienLemaire

Copy link
Copy Markdown

Just tried to use flutter_riverpod master, hoping that I could use the riverpod generator, but I can't start the project with error

Waiting for connection from debug service on Chrome...          
../../../../.pub-cache/git/riverpod-fe305c02f5cc502c628873401d82a693d56296dc/packages/flutter_riverpod/lib/src/change_notifier_provider/auto_dispose.dart:96:12: Error: The method 'FamilyOverrideImpl' isn't defined for the class 'AutoDisposeChangeNotifierProviderFamily<NotifierT, Arg>'.
 - 'AutoDisposeChangeNotifierProviderFamily' is from 'package:flutter_riverpod/src/change_notifier_provider.dart' ('../../../../.pub-cache/git/riverpod-fe305c02f5cc502c628873401d82a693d56296dc/packages/flutter_riverpod/lib/src/change_notifier_provider.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FamilyOverrideImpl'.
    return FamilyOverrideImpl<NotifierT, Arg,
           ^^^^^^^^^^^^^^^^^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid argument: Maximum call stack size exceeded (bug in dart compiler)

5 participants