2 positional argument(s) expected, but 0 found. Flutter

Viewed 40

I'm new in Flutter and i traed to do a note app with Flutter & Firebase. But I have this problem to redirect a SpeedDial button to other page. Do someone know what is the problem? I tried to put data and ref as arguments but I have the problem too.

This is the menu code, here I want to redirect the user to notes page with this SpeedDial

SpeedDialChild(
            child: const Icon(
              Icons.text_fields_rounded,
              color: violeta,
            ),
            label: 'notes',
            labelStyle: TextStyle(color: violeta),
            backgroundColor: amarillo,
            onTap: (() {
              Navigator.of(context).push(MaterialPageRoute(
                builder: ((context) => notas()),
              ));
            })),

And this is the part of the notes page where I declared the arguments to connect the new note with flutter

class notes extends StatefulWidget {
  late String tituloTexto;
  late String notaTexto;
  late String nomCuaderno;
  late final Map data;
  late final DocumentReference ref;

  notas(this.data, this.ref);

  @override
  State<notas> createState() => _notasState();
}

I really apreciette if someone can help me.

Thank you! <3

1 Answers

you need to put the arguments into notas() in Navigator.of(context).push(MaterialPageRoute(builder: ((context) => notas()).

because the notas constructor needs 2 arguments notas(this.data, this.ref);

Related