Karee Inject

Library used to help developers to better manage dependency injection during flutter development.


Karee Inject provide an amazing collection of annotation like Service for services, Value for reading value from application config file, Autowired to auto initialize classe and Persistable A simple usage example:

Use of @Persistable with data model

import 'package:karee_inject/karee_inject.dart';

class User {

  double id;
  String name;

  User(this.id, this.name);


Use of Service to define a service, Autowired and Value to inject application configuration and other services.

class ServiceUser {

  late final String baseUrl;

  late final DatabaseInterface db;

  User? getUserById(double id){

    return db
      .where('id', isEqualTo: id);

Use of Controller to define a Controller, and Autowired to inject Services property;

class UserController {

  late final UserService userService;

  void showUserDetailView(double id){

    User? user = userService.getUserById();
    if(user == null){
      screen(UserNotFoundScreen(), RouteMode.PUSH);

    screen(UserDetailScreen(user: user), RouteMode.PUSH);  


# Generate additional source first
flutter packages pub run build_runner build --delete-conflicting-outputs

# Then run test
flutter test