Resolving DateTime Parsing Error from API Call in FlutterFlow with Supabase

Hello FlutterFlow Community, I'm currently working on a project that involves fetching data from a Supabase API.

However, I've encountered a challenging issue regarding DateTime data types.

Whenever I include a DateTime field in the datatype, I receive an error.

For instance, when I add the "created_at" field, the following error is thrown:

Uncaught (in promise) Error: Expected a value of type 'DateTime?', but got one of type 'String'

Here's a sample of the JSON data I'm receiving from the API:

{
    "id": 1,
    "created_at": "2024-03-01T19:59:59.413955+00:00",
    "proyecto_id": 21,
    "nombre": "Juan Perez",
    "genero": "hombre",
    "rut": "11111111-1",
    "bloqueado": null,
    "canales_contacto": null,
    "vector_busqueda": null,
    "imagen_url": null,
    "empresa": "Redcumbre"
}

The error occurs at runtime when the "created_at" field is included in the data type. It seems the API returns a DateTime field as a string, which FlutterFlow is not automatically converting to a DateTime object.

Has anyone faced a similar issue or have suggestions on how to effectively parse this string to a DateTime format in FlutterFlow? Any insights or guidance would be greatly appreciated.

Thanks in advance for your help!

4
11 replies