get_it_di_global_variable 0.0.6
get_it_di_global_variable: ^0.0.6 copied to clipboard
A tiny Dart package that exposes a global instance of GetIt (sl) for easy and consistent dependency injection across your Flutter or Dart project.
// Example Service
import 'package:get_it_di_global_variable/get_it_di.dart';
class MyService {
void performAction() {
print("Action performed by MyService!");
}
}
void setup() {
// Registering the service using GetIt
sl.registerLazySingleton<MyService>(() => MyService());
}
void main() {
setup(); // Register the services
// Accessing the registered service
final myService = sl<MyService>();
// Using the service
myService.performAction();
}