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

Added annotations for code generator #4

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.0

- Added annotations for the generator

## 1.0.0

- Possibility to pass arguments to factory resolutions
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A dart library which provides abstractions for dependency injection.
- **Framework Agnostic**: Designed to be a flexible wrapper, this package can be used with any Dependency Injection (DI) framework, offering a unified interface for service registration and resolution.
- **Multiple Service Resolution**: Supports resolving multiple services registered under the same interface, enhancing the flexibility of service retrieval in complex applications.
- **Custom Adapter Integration**: Enables users to integrate any external DI framework by writing custom adapters, ensuring compatibility and extending functionality according to project needs.
- **Code generation**: Automatic dependency registration and resolution.

## Getting Started

Expand Down Expand Up @@ -155,6 +156,10 @@ final UserService userService =

If you don't pass a required named argument, a `TypeError` will be thrown.

## Code generation

If you want to use the code generator, please refer to [this package here](https://pub.dev/zef_di_abstractions_generator).

## Customization and Extensibility

Our package's design encourages customization and extensibility. By creating adapters for your chosen DI frameworks, you can leverage our wrapper's features while utilizing the specific functionalities and optimizations of those frameworks.
Expand Down
26 changes: 26 additions & 0 deletions lib/src/annotations/annotations.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
abstract class Registration {
final String? _name;
final dynamic _key;
final String? _environment;

const Registration({String? name, dynamic key, String? environment})
: _name = name,
_key = key,
_environment = environment;

String? get name => _name;
dynamic get key => _key;
String? get environment => _environment;
}

class RegisterInstance extends Registration {
const RegisterInstance({super.name, super.key, super.environment});
}

class RegisterFactory extends Registration {
const RegisterFactory({super.name, super.key, super.environment});
}

class RegisterFactoryMethod {
const RegisterFactoryMethod();
}
5 changes: 1 addition & 4 deletions lib/zef_di_abstractions.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/// Support for doing something awesome.
///
/// More dartdocs go here.
library;

export 'src/service_locator.dart';
export 'src/service_locator_adapter.dart';
export 'src/service_locator_config.dart';

export 'src/responses/index.dart';
export 'src/annotations/annotations.dart';
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: zef_di_abstractions
description: A dart library which provides abstractions for dependency injection.
version: 1.0.0
version: 1.1.0
homepage: https://www.zooper.dev
repository: https://github.com/zooper-lib/ZEF_DI_Abstractions
topics:
Expand Down
Loading