AFComponentStates.createFrom constructor

AFComponentStates.createFrom(
  1. List<AFComponentState> areas
)

Implementation

factory AFComponentStates.createFrom(List<AFComponentState> areas) {
  final states = <String, AFComponentState>{};
  for(final area in areas) {
    final areaType = _keyForComponent(area);
    states[areaType] = area;
  }

  // if you don't have a state, you can use AFFlexibleState as a substitute.  We need to have this
  // be non-null, so we add an empty one.
  final tempModel = AFComponentStateUnused(const <String, Object>{});
  final areaType = _keyForComponent(tempModel);
  states[areaType] = tempModel;

  return AFComponentStates(states: states);
}