Skip to content

Commit

Permalink
allow null arguments in providers
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin-morocho committed Nov 11, 2023
1 parent f346df7 commit a5224af
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 16 deletions.
3 changes: 3 additions & 0 deletions packages/flutter_meedu/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [9.0.7]
- Updated to meedu: ^9.0.1

## [9.0.6]
- Updated to meedu: ^9.0.0

Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_meedu/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ packages:
dependency: "direct main"
description:
name: meedu
sha256: "77735c8699253ac58312c504b857c5a5b95a70bb73937ca4a13ccae37d61f42e"
sha256: c189d65d7fd3ba3435bc046531ed2eee30ce389a8510161c508c23c30a8d22bd
url: "https://pub.dev"
source: hosted
version: "9.0.0"
version: "9.0.1"
meta:
dependency: "direct main"
description:
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_meedu/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_meedu
description: A powerful State Management, Dependency Injection, Reactive programming and Navigation for Flutter apps.
version: 9.0.6
version: 9.0.7
homepage: https://github.com/darwin-morocho/flutter-meedu/tree/master/packages/flutter_meedu
documentation: https://flutter.meedu.app

Expand All @@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter
meta: ^1.9.1
meedu: ^9.0.0
meedu: ^9.0.1

dev_dependencies:
equatable: ^2.0.5
Expand Down
4 changes: 4 additions & 0 deletions packages/hooks_meedu/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.4
- Upgrade to
flutter_meedu: ^9.0.7

## 0.1.3
- Upgrade to
flutter_meedu: ^9.0.6
Expand Down
4 changes: 2 additions & 2 deletions packages/hooks_meedu/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: hooks_meedu
description: A way to use both flutter_hooks and flutter_meedu together.
version: 0.1.3
version: 0.1.4
homepage: https://github.com/darwin-morocho/flutter-meedu/tree/master/packages/hooks_meedu
documentation: https://flutter.meedu.app

Expand All @@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter
flutter_hooks: ^0.20.2
flutter_meedu: ^9.0.6
flutter_meedu: ^9.0.7

dev_dependencies:
flutter_test:
Expand Down
3 changes: 3 additions & 0 deletions packages/meedu/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [9.0.1]
- Allow null arguments in Providers.

## [9.0.0]
- Release 9.x

Expand Down
19 changes: 13 additions & 6 deletions packages/meedu/lib/provider/providers_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,31 @@ class Ref<A> {
});

final String? tag;
bool _argumentsInitialized = false;

A? _arguments;
late A _arguments;
A get arguments {
assert(
_arguments != null,
'arguments not initialized, make sure to call to yourProvoder.setArguments(...) before',
_argumentsInitialized,
'arguments not initialized, make sure to call to yourProvider.setArguments(...) before',
);
return _arguments!;
return _arguments;
}

void Function()? _onDisposeCallback;

void setArguments(A args) => _arguments = args;
void setArguments(A args) {
_arguments = args;
_argumentsInitialized = true;
}

void onDispose(void Function() callback) => _onDisposeCallback = callback;

@protected
void dispose() => _onDisposeCallback?.call();
void dispose() {
_argumentsInitialized = false;
_onDisposeCallback?.call();
}
}

class ProvidersContainer {
Expand Down
2 changes: 1 addition & 1 deletion packages/meedu/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: meedu
description: A simple State Managment, Dependency Injection, Reactive programming for dart Projects.
version: 9.0.0
version: 9.0.1
homepage: https://github.com/darwin-morocho/flutter-meedu/tree/master/packages/meedu
documentation: https://flutter.meedu.app

Expand Down
2 changes: 1 addition & 1 deletion website/docs/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ First add [hooks_meedu](https://pub.dev/packages/hooks_meedu) to your `pubspec.y
```yaml
dependencies:
flutter_hooks: lastest_version
hooks_meedu: ^0.1.3
hooks_meedu: ^0.1.4
```
Expand Down
2 changes: 1 addition & 1 deletion website/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ environment:
flutter: ">=3.10.0"

dependencies:
flutter_meedu: ^9.0.6
flutter_meedu: ^9.0.7

dev_dependencies:
meedu_lints: ^0.0.6 # <--- ADD THIS
Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module.exports = {
lastVersion: "current",
versions: {
current: {
label: "9.0.5",
label: "9.0.7",
},
"8.x.x": {
label: "8.5.0",
Expand Down

0 comments on commit a5224af

Please sign in to comment.