Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ref.exists #1844

Merged
merged 1 commit into from Oct 30, 2022
Merged

Add Ref.exists #1844

merged 1 commit into from Oct 30, 2022

Conversation

rrousselGit
Copy link
Owner

closes #1843

@rrousselGit rrousselGit marked this pull request as ready for review October 30, 2022 14:20
@codecov
Copy link

codecov bot commented Oct 30, 2022

Codecov Report

Merging #1844 (c5b7597) into master (8b3ab0c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1844   +/-   ##
=======================================
  Coverage   95.47%   95.48%           
=======================================
  Files          49       49           
  Lines        2055     2059    +4     
=======================================
+ Hits         1962     1966    +4     
  Misses         93       93           
Impacted Files Coverage Δ
packages/riverpod/lib/src/framework/container.dart 96.17% <100.00%> (+0.03%) ⬆️
packages/riverpod/lib/src/framework/element.dart 98.25% <100.00%> (+0.01%) ⬆️

@rrousselGit rrousselGit merged commit 3ddbb5c into master Oct 30, 2022
@rrousselGit rrousselGit deleted the exists branch October 30, 2022 14:51
Copy link
Contributor

@giandifra giandifra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await is missing in documentation example

I created a PR #1868

/// if (ref.exists(fetchItemList)) {
/// // If `fetchItemList` is initialized, we look into its state
/// // and return the already obtained item.
/// final itemFromItemList = ref.watch(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "await" is missing here. Without "await" itemFromItemList is always != null because it is a Future<Item?>

/// if (ref.exists(fetchItemList)) {
/// // If `fetchItemList` is initialized, we look into its state
/// // and return the already obtained item.
/// final itemFromItemList = ref.watch(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem here, i think "await" is missing

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.

Add a way to imperatively determine if a provider is initialized or not.
2 participants