dependency_scope

Creator: coderz1093

Last updated:

0 purchases

dependency_scope Image
dependency_scope Images

Languages

Categories

Add to Cart

Description:

dependency scope

Dependency Scope #
Dependency Scope is a Flutter package designed to facilitate the use of Dependency Injection (DI) in Flutter projects.
This package provides a straightforward way to manage dependencies, improving code modularity and testability.
Features #

Simplifies dependency injection setup in Flutter applications.
Enhances code maintainability and readability.
Supports easy and efficient management of app-wide dependencies.

Installation #

Add the following to your pubspec.yaml file:

dependencies:
dependency_scope: ^1.1.0
copied to clipboard
Getting started #

Setup: Initialize the DependencyScope in your main app file.
Register Dependencies: Register your dependencies in the DependencyScope.
Inject Dependencies: Use the provided methods to inject dependencies where needed.

Usage #
Include short and useful examples for package users. Add longer examples
to /example folder.
final class AppDependency extends DependencyScope {
late final String title;

@override
Future<void> initialization() async {
title = await create(() => 'Flutter DI');
}
}
copied to clipboard
And
class App extends StatelessWidget {
final AppDependency appDependency;

const App({super.key, required this.appDependency});

@override
Widget build(BuildContext context) {
return DependencyProvider<AppDependency>(
dependency: appDependency,
child: const MaterialApp(
home: MyHomePage(),
),
);
}
}
copied to clipboard
After this you can use DI with context extension
final appDependency = context.get<AppDependency>();
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.