From 91d578a5305fe39a89f60432a0691617976ed10b Mon Sep 17 00:00:00 2001 From: Jacob Moura Date: Thu, 2 Jun 2022 12:32:28 -0300 Subject: [PATCH 1/4] fix: prepare to publish --- flutter_modular/CHANGELOG.md | 4 ++++ .../example/windows/flutter/generated_plugins.cmake | 8 ++++++++ flutter_modular/pubspec.yaml | 4 ++-- modular_core/CHANGELOG.md | 3 +++ modular_core/pubspec.yaml | 4 ++-- modular_interfaces/CHANGELOG.md | 4 ++++ modular_interfaces/pubspec.yaml | 2 +- 7 files changed, 24 insertions(+), 5 deletions(-) diff --git a/flutter_modular/CHANGELOG.md b/flutter_modular/CHANGELOG.md index fa8a1bc1..a89b0d72 100644 --- a/flutter_modular/CHANGELOG.md +++ b/flutter_modular/CHANGELOG.md @@ -1,3 +1,7 @@ +## [5.0.3] - 2022-06-02 +- Fix [#676](https://github.com/Flutterando/modular/issues/676) +- Fix [#632](https://github.com/Flutterando/modular/issues/632) + ## [5.0.2] - 2022-04-22 - Fix: Parse params in RouteOutlet ## [5.0.1] - 2022-04-22 diff --git a/flutter_modular/example/windows/flutter/generated_plugins.cmake b/flutter_modular/example/windows/flutter/generated_plugins.cmake index 4d10c251..b93c4c30 100644 --- a/flutter_modular/example/windows/flutter/generated_plugins.cmake +++ b/flutter_modular/example/windows/flutter/generated_plugins.cmake @@ -5,6 +5,9 @@ list(APPEND FLUTTER_PLUGIN_LIST ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/flutter_modular/pubspec.yaml b/flutter_modular/pubspec.yaml index e646633d..7b14602e 100644 --- a/flutter_modular/pubspec.yaml +++ b/flutter_modular/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_modular description: Smart project structure with dependency injection and route management -version: 5.0.2 +version: 5.0.3 homepage: https://github.com/Flutterando/modular environment: @@ -8,7 +8,7 @@ environment: dependencies: flutter_modular_annotations: ^0.0.2 - modular_core: ">=2.0.1 <3.0.0" + modular_core: ">=2.0.3+1 <3.0.0" meta: ">=1.3.0 <2.0.0" flutter: sdk: flutter diff --git a/modular_core/CHANGELOG.md b/modular_core/CHANGELOG.md index b7cdfe32..48607c84 100644 --- a/modular_core/CHANGELOG.md +++ b/modular_core/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.0.3+1 - 2022/06/02 +* feat: Added type propertie in removeBindContext + ## 2.0.1 - 2022/05/12 * Fix: Inject.get should return instance diff --git a/modular_core/pubspec.yaml b/modular_core/pubspec.yaml index b70be033..4e894c82 100644 --- a/modular_core/pubspec.yaml +++ b/modular_core/pubspec.yaml @@ -1,6 +1,6 @@ name: modular_core description: Smart project structure with dependency injection and route management -version: 2.0.1 +version: 2.0.3+1 homepage: https://github.com/Flutterando/modular environment: @@ -9,7 +9,7 @@ environment: dependencies: characters: ">=1.1.0 <2.0.0" meta: ">=1.3.0 <2.0.0" - modular_interfaces: ">=2.0.1 <3.0.0" + modular_interfaces: ">=2.0.2 <3.0.0" dev_dependencies: diff --git a/modular_interfaces/CHANGELOG.md b/modular_interfaces/CHANGELOG.md index bf019609..30a03ee7 100644 --- a/modular_interfaces/CHANGELOG.md +++ b/modular_interfaces/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.2 - 2022/06/02 + +- feat: Added Type propertie in removeBindContext(); + ## 2.0.1 - 2022/05/12 - Fix: Inject.get returns instance diff --git a/modular_interfaces/pubspec.yaml b/modular_interfaces/pubspec.yaml index 26960024..a72920f9 100644 --- a/modular_interfaces/pubspec.yaml +++ b/modular_interfaces/pubspec.yaml @@ -1,6 +1,6 @@ name: modular_interfaces description: Smart project structure with dependency injection and route management -version: 2.0.1 +version: 2.0.2 homepage: https://github.com/Flutterando/modular # homepage: https://www.example.com From 29f22ee470e5d237e294c9c658a69845ab887cac Mon Sep 17 00:00:00 2001 From: Jacob Moura Date: Fri, 3 Jun 2022 10:55:53 -0300 Subject: [PATCH 2/4] fix: added copywith in asyncBind --- .../windows/flutter/generated_plugins.cmake | 8 --- .../lib/src/presenter/models/bind.dart | 52 +++++++++---------- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/flutter_modular/example/windows/flutter/generated_plugins.cmake b/flutter_modular/example/windows/flutter/generated_plugins.cmake index b93c4c30..4d10c251 100644 --- a/flutter_modular/example/windows/flutter/generated_plugins.cmake +++ b/flutter_modular/example/windows/flutter/generated_plugins.cmake @@ -5,9 +5,6 @@ list(APPEND FLUTTER_PLUGIN_LIST ) -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -16,8 +13,3 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/flutter_modular/lib/src/presenter/models/bind.dart b/flutter_modular/lib/src/presenter/models/bind.dart index a53d7505..54ab3303 100644 --- a/flutter_modular/lib/src/presenter/models/bind.dart +++ b/flutter_modular/lib/src/presenter/models/bind.dart @@ -35,38 +35,20 @@ class Bind extends BindContract { } ///Bind an already exist 'Instance' of object.. - static Bind instance(T instance, - {bool export = false, dynamic Function(T value)? selector}) { - return Bind((i) => instance, - isSingleton: false, isLazy: true, export: export, selector: selector); + static Bind instance(T instance, {bool export = false, dynamic Function(T value)? selector}) { + return Bind((i) => instance, isSingleton: false, isLazy: true, export: export, selector: selector); } ///Bind a 'Singleton' class. ///Built together with the module. ///The instance will always be the same. - static Bind singleton(T Function(Injector i) inject, - {bool export = false, - void Function(T value)? onDispose, - dynamic Function(T value)? selector}) { - return Bind(inject, - isSingleton: true, - isLazy: false, - export: export, - onDispose: onDispose, - selector: selector); + static Bind singleton(T Function(Injector i) inject, {bool export = false, void Function(T value)? onDispose, dynamic Function(T value)? selector}) { + return Bind(inject, isSingleton: true, isLazy: false, export: export, onDispose: onDispose, selector: selector); } ///Create single instance for request. - static Bind lazySingleton(T Function(Injector i) inject, - {bool export = false, - void Function(T value)? onDispose, - dynamic Function(T value)? selector}) { - return Bind(inject, - isSingleton: true, - isLazy: true, - export: export, - onDispose: onDispose, - selector: selector); + static Bind lazySingleton(T Function(Injector i) inject, {bool export = false, void Function(T value)? onDispose, dynamic Function(T value)? selector}) { + return Bind(inject, isSingleton: true, isLazy: true, export: export, onDispose: onDispose, selector: selector); } ///Bind a factory. Always a new constructor when calling Modular.get @@ -100,8 +82,7 @@ class Bind extends BindContract { } /// AsyncBind represents an asynchronous Bind that can be resolved before module initialization by calling Modular.isModuleReady() or called with Modular.getAsync() -class AsyncBind extends Bind> - implements AsyncBindContract { +class AsyncBind extends Bind> implements AsyncBindContract { @override final Future Function(Injector i) asyncInject; @@ -123,8 +104,23 @@ class AsyncBind extends Bind> @override Future> convertToBind() async { final bindValue = await resolveAsyncBind(); - return Bind((i) => bindValue, - export: export, alwaysSerialized: true, onDispose: _localOnDispose); + return Bind((i) => bindValue, export: export, alwaysSerialized: true, onDispose: _localOnDispose); + } + + @override + AsyncBind copyWith( + {Future Function(Injector i)? factoryFunction, + bool? isSingleton, + bool? isLazy, + bool? export, + bool? isScoped, + bool? alwaysSerialized, + void Function(Future value)? onDispose, + Function(Future value)? selector}) { + return AsyncBind( + factoryFunction ?? this.factoryFunction, + export: export ?? this.export, + ); } } From 99c0ffdcda8186605292301842b2fb7126acb22d Mon Sep 17 00:00:00 2001 From: Jacob Moura Date: Fri, 3 Jun 2022 11:05:54 -0300 Subject: [PATCH 3/4] fix: 713 --- flutter_modular/pubspec.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/flutter_modular/pubspec.yaml b/flutter_modular/pubspec.yaml index 7b14602e..d611f7ff 100644 --- a/flutter_modular/pubspec.yaml +++ b/flutter_modular/pubspec.yaml @@ -13,12 +13,6 @@ dependencies: flutter: sdk: flutter -dependency_overrides: - modular_core: - path: ../modular_core - modular_interfaces: - path: ../modular_interfaces - dev_dependencies: flutter_lints: ^1.0.4 mocktail: ^0.1.4 From fc406cee23e3ed4e1daed5a09c9eee45dad140f4 Mon Sep 17 00:00:00 2001 From: Jacob Moura Date: Fri, 3 Jun 2022 11:11:00 -0300 Subject: [PATCH 4/4] format files --- flutter_modular/CHANGELOG.md | 3 +- .../lib/src/presenter/models/bind.dart | 36 ++++++++++++++----- .../test/src/presenter/models/bind_test.dart | 6 ++++ 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/flutter_modular/CHANGELOG.md b/flutter_modular/CHANGELOG.md index a89b0d72..cbc9ff9b 100644 --- a/flutter_modular/CHANGELOG.md +++ b/flutter_modular/CHANGELOG.md @@ -1,4 +1,5 @@ -## [5.0.3] - 2022-06-02 +## [5.0.3] - 2022-06-03 +- Fix [#713](https://github.com/Flutterando/modular/issues/713) - Fix [#676](https://github.com/Flutterando/modular/issues/676) - Fix [#632](https://github.com/Flutterando/modular/issues/632) diff --git a/flutter_modular/lib/src/presenter/models/bind.dart b/flutter_modular/lib/src/presenter/models/bind.dart index 54ab3303..ed5174c5 100644 --- a/flutter_modular/lib/src/presenter/models/bind.dart +++ b/flutter_modular/lib/src/presenter/models/bind.dart @@ -35,20 +35,38 @@ class Bind extends BindContract { } ///Bind an already exist 'Instance' of object.. - static Bind instance(T instance, {bool export = false, dynamic Function(T value)? selector}) { - return Bind((i) => instance, isSingleton: false, isLazy: true, export: export, selector: selector); + static Bind instance(T instance, + {bool export = false, dynamic Function(T value)? selector}) { + return Bind((i) => instance, + isSingleton: false, isLazy: true, export: export, selector: selector); } ///Bind a 'Singleton' class. ///Built together with the module. ///The instance will always be the same. - static Bind singleton(T Function(Injector i) inject, {bool export = false, void Function(T value)? onDispose, dynamic Function(T value)? selector}) { - return Bind(inject, isSingleton: true, isLazy: false, export: export, onDispose: onDispose, selector: selector); + static Bind singleton(T Function(Injector i) inject, + {bool export = false, + void Function(T value)? onDispose, + dynamic Function(T value)? selector}) { + return Bind(inject, + isSingleton: true, + isLazy: false, + export: export, + onDispose: onDispose, + selector: selector); } ///Create single instance for request. - static Bind lazySingleton(T Function(Injector i) inject, {bool export = false, void Function(T value)? onDispose, dynamic Function(T value)? selector}) { - return Bind(inject, isSingleton: true, isLazy: true, export: export, onDispose: onDispose, selector: selector); + static Bind lazySingleton(T Function(Injector i) inject, + {bool export = false, + void Function(T value)? onDispose, + dynamic Function(T value)? selector}) { + return Bind(inject, + isSingleton: true, + isLazy: true, + export: export, + onDispose: onDispose, + selector: selector); } ///Bind a factory. Always a new constructor when calling Modular.get @@ -82,7 +100,8 @@ class Bind extends BindContract { } /// AsyncBind represents an asynchronous Bind that can be resolved before module initialization by calling Modular.isModuleReady() or called with Modular.getAsync() -class AsyncBind extends Bind> implements AsyncBindContract { +class AsyncBind extends Bind> + implements AsyncBindContract { @override final Future Function(Injector i) asyncInject; @@ -104,7 +123,8 @@ class AsyncBind extends Bind> implements AsyncBindCo @override Future> convertToBind() async { final bindValue = await resolveAsyncBind(); - return Bind((i) => bindValue, export: export, alwaysSerialized: true, onDispose: _localOnDispose); + return Bind((i) => bindValue, + export: export, alwaysSerialized: true, onDispose: _localOnDispose); } @override diff --git a/flutter_modular/test/src/presenter/models/bind_test.dart b/flutter_modular/test/src/presenter/models/bind_test.dart index 2a88a7e4..8eb0a9d9 100644 --- a/flutter_modular/test/src/presenter/models/bind_test.dart +++ b/flutter_modular/test/src/presenter/models/bind_test.dart @@ -1,5 +1,6 @@ import 'package:flutter_modular/src/presenter/models/bind.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:modular_core/modular_core.dart'; void main() { test('bind instance', () { @@ -42,4 +43,9 @@ void main() { final bind = BindInject((i) => 'instance'); expect(bind.copyWith(), isA()); }); + + test('copyWith asyncBind', () async { + final asyncBind = AsyncBind((i) async => 'instance'); + expect(asyncBind.copyWith(), isA()); + }); }