get_it_mixin 4.2.2 get_it_mixin: ^4.2.2 copied to clipboard
mixin on Stateless- and StatefulWidgts that makes binding the Widget to Objects stored in GetIt easier.
import 'package:flutter/material.dart';
import 'package:flutter_weather_demo/weather_manager.dart';
import 'package:get_it/get_it.dart';
import 'homepage.dart';
void main() {
registerManager();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: HomePage(),
);
}
}
void registerManager() {
GetIt.I.registerSingleton<WeatherManager>(WeatherManager());
}