useInstancePart<InstancePartType extends BaseInstancePart<dynamic, MvvmInstance> > method
InstancePartType
useInstancePart<InstancePartType extends BaseInstancePart<dynamic, MvvmInstance> >({
- int index = 0,
Returns initialized instance part for given type
index
- index for this part
Implementation
InstancePartType useInstancePart<InstancePartType extends BaseInstancePart>({
int index = 0,
}) {
if (_parts[InstancePartType] == null) {
throw IllegalStateException(
message: 'Part $InstancePartType is not connected.',
);
}
if (index < 0 || index >= _parts[InstancePartType]!.length) {
throw IllegalArgumentException(
message:
'The index = $index value must be non-negative and less than count of parts of $InstancePartType.',
);
}
return _parts[InstancePartType]![index] as InstancePartType;
}