skip to Main Content

useEffect or useMemoized in Flutter

If I want to initialize object in hook widget, should I use useEffect or useMemoized? class CreateUserScreen extends HookWidget { late ABC abc; CreateUserScreen({super.key}); @override Widget build(BuildContext context) { useEffect(() { abc = ABC(); return null; }); ... } or…

VIEW QUESTION

Flutter – List not updating after item added

I want to add item in list when floatingAction button is clicked. class EditAgentVehiclesListScreen extends HookWidget { final ValueNotifier<List<VehicleItems>> list; const EditAgentVehiclesListScreen(this.list, {super.key}); @override Widget build(BuildContext context) { return Scaffold( floatingActionButton: FloatingActionButton( backgroundColor: AppTheme.light.colorScheme.primary, onPressed: () { Navigator.pushNamed(context, TenancyRoutes.createVehicleItemsScreen) .then(((onValue)…

VIEW QUESTION

Flutter – ToggleButton not changing state

I have three toggle button in my page. When I click either one of the toggle button, it remain unchanged. class EditInvoiceDetailsScreen extends HookWidget { final Invoice invoice; EditInvoiceDetailsScreen(this.invoice, {super.key}); @override Widget build(BuildContext context) { final isSelected = useState(<bool>[true, false,…

VIEW QUESTION
Back To Top
Search