Skip to content

Error deserializing #85

@knightsforce

Description

@knightsforce

When receiving JSON:
[ { "id": 1, "name": "Test", "schedule": { "slots": [ [], [], [], [], [], [], [ { "time_from": "10:30:00", "time_to": "15:45:00" } ] ] } } ]

I get an error after the response:
DioError [unknown]: null I/flutter (19668): │ Error: Deserializing '[{id: 2, name: Test, email: test@gmail.com...' to 'BuiltList<OverviewPlace>' failed due to: Deserializing '[id, 2, name, Test, email, test@gmail.com...' to 'OverviewPlace' failed due to: Deserializing '[slots, [[], [{time_from: 07:00:00, time_to: 14:00:00}, {time_from: 15:00:00,...' to 'Schedule?' failed due to: Deserializing '[[], [{time_from: 07:00:00, time_to: 14:00:00}, {time_from: 15:00:00, time_to...' to 'BuiltList<BuiltList<TimeSlot>>' failed due to: Deserializing '[]' to 'BuiltList<TimeSlot>' failed due to: Bad state: No builder factory for BuiltList<TimeSlot>. Fix by adding one, see SerializersBuilder.addBuilderFactory.

It was solved by adding the code to the serializers.dart file:
..addBuilderFactory( const FullType(BuiltList, [FullType(TimeSlot)]), () => ListBuilder<TimeSlot>(), )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions