forked from Milad-Akarie/injectable
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix importing issue for bin/test folders support injectables in register module custom initializr
- Loading branch information
Milad Alakarie
committed
May 11, 2020
1 parent
1630827
commit 8fba365
Showing
25 changed files
with
308 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import 'package:example/injector.dart'; | ||
|
||
void main(List<String> arguments) { | ||
configure(); | ||
print('x'); | ||
configureDependecies(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,26 @@ | ||
import 'package:example/user.dart'; | ||
import 'package:injectable/injectable.dart'; | ||
import 'package:i18n_extension/default.i18n.dart'; | ||
|
||
import 'generic.dart'; | ||
|
||
@registerModule | ||
@module | ||
abstract class RegisterModule { | ||
// AbsService get absS; | ||
// Future<ServiceX> genIml(String x, int y) async => ServiceX(); | ||
// @singleton | ||
// ServiceX ser(); | ||
// @singleton | ||
// TestClass get testClass; | ||
// TestSingleton2 get testSing33; | ||
|
||
BackendService testSing(User<Generic> x, int y) => | ||
BackendService("Title".i18n); | ||
|
||
// BackendService getService(String url) => BackendService(url); | ||
// @preResolve | ||
// @Singleton(dependsOn: [TestClass]) | ||
// Future<TestSingleton> get futureSing => TestSingleton.create(); | ||
|
||
// TestSingleton2 get test; | ||
@preResolve | ||
Future<ApiClient> get apiClient => ApiClient.create(); | ||
} | ||
// @Singleton(as: LocalStorage) | ||
LocalStorage apiClient( | ||
@factoryParam String url, | ||
LocalStorage localStorage, | ||
@factoryParam int x, | ||
) => | ||
ApiClient.named(url); | ||
|
||
// // @Named("class") | ||
// // @injectable | ||
// class TestSingleton2 { | ||
// TestSingleton2(AbsService service); | ||
// } | ||
|
||
// abstract class AbsService<T> {} | ||
|
||
// @injectable | ||
class BackendService { | ||
final String title; | ||
|
||
BackendService(this.title); | ||
// @singleton | ||
// ApiClient api(String x) => ApiClient.named(x); | ||
} | ||
|
||
// @RegisterAs(BackendService, env: 'test') | ||
// @injectable | ||
// class BackendServiceMock extends Mock implements BackendService {} | ||
|
||
// @injectable | ||
class ApiClient { | ||
// @singleton | ||
// @RegisterAs(LocalStorage) | ||
// @test | ||
@Injectable(as: LocalStorage) | ||
class ApiClient extends LocalStorage { | ||
@factoryMethod | ||
static Future<ApiClient> create() async { | ||
return ApiClient(); | ||
} | ||
ApiClient.named(String url); | ||
} | ||
|
||
abstract class LocalStorage {} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.