I was trying to add different useState in my page with Flutter hook but i can’t find a way to do it by giving them a type first, because of the inital value requested.
i can’t initialize my useState with :
QRViewController? controller = useState();
final controller = useState<QRViewController>()
QRViewController? controller = useState(null);
How can i initialized controller with custom type ?
final ValueNotifier<QRViewController?> controller = useState(null);
final controller = useState<QRViewController?>(null);
You were very close.
Answered By – Tim Jacobs
Answer Checked By – Jay B. (FlutterFixes Admin)