Skip to content

Commit

Permalink
Release 0.2.1 Ready
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham16g committed Jan 10, 2023
1 parent 5fc3086 commit 87f4a41
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.2.1
StateFlow updated
- notifyOnSameValue added
- github-pages setup for example

## 0.2.0
Builder, Consumer, and Listener Fixed
- Fixed Bug
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,14 @@ class CustomViewModel extends ViewModel {
> It is recommended to initialize private `MutableStateFlow` and create a public `StateFlow` getter of it.
```dart
final _myStateFlow = MutableStateFlow<int>(1);
final _myStateFlow = MutableStateFlow<int>(1, notifyOnSameValue: true);
StateFlow<int> get myStateFlow => _myStateFlow;
```


Here, notifyOnSameValue is optional. If `notifyOnSameValue` is set to false, whenever you call `stateFlow.value = newValue`
where newValue is same as current value, it will not notify listeners. by default it is set to true.

**To change the value**

```dart
Expand Down
2 changes: 2 additions & 0 deletions lib/src/flow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class StateFlow<T> extends ChangeNotifier {
/// get the current value.
T get value => _value;

/// If [notifyOnSameValue] is set to false, whenever you call `stateFlow.value = newValue`
/// where newValue is same as current value, it will not notify listeners. by default it is set to true.
StateFlow(this._value, {this.notifyOnSameValue = true});
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: view_model_x
description: An Android similar state management package (StateFlow and SharedFlow with ViewModel) which helps to implement MVVM pattern easily.
version: 0.2.0
version: 0.2.1
homepage: https://github.com/shubham-gupta-16/view_model_x
repository: https://github.com/shubham-gupta-16/view_model_x
issue_tracker: https://github.com/shubham-gupta-16/view_model_x/issues
Expand Down

0 comments on commit 87f4a41

Please sign in to comment.