karee_inject 1.0.2 karee_inject: ^1.0.2 copied to clipboard
Part of Karee that manage all annotation used to inject dependency
Karee Inject #
Library used to help developers to better manage dependency injection during flutter development.
Usage #
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';
@Persistable
class User {
double id;
String name;
}
Use of Service
to define a service, and Autowired
to inject into property;
@Service
class ServiceUser {
@Autowired
DatabaseInterface db;
User getUserById(double id){
return db
.find(User.runtimeType)
.where('id', isEqualTo: id);
}
}
Test #
# Generate additional source first
flutter packages pub run build_runner build --delete-conflicting-outputs
# Then run test
flutter test