defineRootStateObjectList method

List<Object> defineRootStateObjectList(
  1. Object id,
  2. List<Object> sources
)

Given a list of test data ids and object values in sources, resolves them into a list of root state objects, and returns that list.

This method works just as the stateView parameter in UI protoypes does. If you pass in the test id of an existing state object, all it's root objects are used. Then, any additional root objects in sources are written into the state, overwritting those that already exist.

This can be used to create a differentiated state with just a few of the root objects replaced. If you'd like to create a state from the returned list, you can use your XXXState.fromList constructor.

Implementation

List<Object> defineRootStateObjectList(Object id, List<Object> sources) {
  final resolved = resolveStateViewModels(sources);
  final models = define(id, resolved.values.toList());
  return models;
}