androidEventDateFormatter property

String Function(DateTime, bool) androidEventDateFormatter
read / write

Function to use when serializing event dates on Android.

More context: unlike on iOS where the event date is encoded as a datetime in the contacts database, on Android it is encoded as a free-form string, with no specific format specified, meaning the event saved by one app may not be readable by another app. See also https://github.com/QuisApp/flutter_contacts/issues/2

The following default mimics the behavior of the default Android App version 3.38.1 where dates are of the form YYYY-MM-DD or --MM-DD for dates with no year.

Implementation

String Function(DateTime, bool) androidEventDateFormatter =
    (DateTime date, bool noYear) =>
        '${noYear ? '-' : date.year.toString().padLeft(4, '0')}-'
        '${date.month.toString().padLeft(2, '0')}-'
        '${date.day.toString().padLeft(2, '0')}';