Skip to content

Auto add builder factories for nested built_collection classes #1254

@JosephNK

Description

@JosephNK

When using BuiltMap nesting, is it not automatically created?

abstract class Calendar implements Built<Calendar, CalendarBuilder> { 
  ...
  @BuiltValueField(wireName: 'calendar')
    BuiltMap<String, BuiltMap<String, BuiltList<DayDTO>>>? get calendar;
  ...
}

automatically generated below

..addBuilderFactory(
          const FullType(BuiltMap, const [
            const FullType(String),
            const FullType(BuiltMap, const [
              const FullType(String),
              const FullType(
                  BuiltList, const [const FullType(DayDTO)])
            ])
          ]),
          () => new MapBuilder<String,
              BuiltMap<String, BuiltList<DayDTO>>>())

however, the below needs to be added manually.

..addBuilderFactory(
          const FullType(BuiltMap, const [
            const FullType(String),
            const FullType(
                BuiltList, const [const FullType(DayDTO)])
          ]),
          () => new MapBuilder<String, BuiltList<DayDTO>>())
..addBuilderFactory(
        const FullType(
            BuiltList, const [const FullType(DayDTO)]),
        () => new ListBuilder<DayDTO>())

It won't work unless you add it manually in the code above. So you have to add it manually, but it works.

Is there a way to automatically generate it?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions