watch_it 1.5.1 watch_it: ^1.5.1 copied to clipboard
The simple state management powered by get_it. It allows to observe changes of objects inside the get_it service locator and rebuild the UI accordingly.
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());
}