I am trying to create a FocusNode
to list of texts but I fault to do so.
The userNameNode is:
final FocusNode userNameNode =FocusNode();
The usage of userNameNode which caused the error:
Stack(
fit: StackFit.passthrough,
textDirection: TextDirection.ltr,
children: const [
_Image(),
_ListOfInputs(
userNameNode: userNameNode,
)]);
The error of userNameNode is:
The values in a const list literal must be constants.
Try removing the keyword 'const' from the list literal.dart(non_constant_list_element)
The element type 'dynamic' can't be assigned to the list type 'Widget'.
The _ListOfInputs class is:
class _ListOfInputs extends StatelessWidget {
final FocusNode userNameNode;
const ListOfInputs(
this.userNameNode,
);
}
your code is:
Stack(
fit: StackFit.passthrough,
textDirection: TextDirection.ltr,
children: const [
_ListOfInputs(userNameNode: userNameNode,)]);
so change it:
Stack(
fit: StackFit.passthrough,
textDirection: TextDirection.ltr,
children: [
_ListOfInputs(userNameNode: userNameNode,)]);
because the list is not const.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With