flutterdartdatetimeflutter-intl

Why flutter give an error 'Undefined name DateFormat"?


How can I fix it? Please don't say import intl.dart as you can see at the second photo I already add it.

1

2


Solution

  • It might be using the Date Format class from another package.

    -> import 'package:intl/intl.dart' as intl;

    Edit the import like this.

    Try using the date format as below.

    intl.DateFormat.yMMMd().format(transaction[index].date),