El Hombre Sin Nombre
El Hombre Sin Nombre

Reputation: 3092

Undefined class datetime in flutter

I´m trying to create a datetime select in flutter. I have the frontend but I need to create function to show date time selector. I follow this video but i don´t know why return

Undefined Class 'Datetime'`

  DateTime date = new DateTime.now();

  Future<Null> selectDate(BuildContext context) async {
    final Datetime picked = await showDatePicker(
        context: context,
        initialDate: date,
        firstDate: new DateTime(2010),
        lastDate: null);
    if (picked != null && picked != date) {
      print('date selected: ${date.toString()}');
      setState(() {
        date = picked;
      });
    }
  }

So anybody has idea what is wrong?

Upvotes: 1

Views: 1812

Answers (1)

Zroq
Zroq

Reputation: 8392

You have a typo declaring your picked variable - should be DateTime with a capital T.

Upvotes: 2

Related Questions