addInstance method
void
addInstance(
- int key
)
Implementation
void addInstance(int key) {
final List<int> existingKeys = findExistingPathKeys();
final int keyCount = existingKeys.length;
if (keyCount > 0) {
final WidgetPath firstPath = widgetContexts[existingKeys[0]];
if (!firstPath.usedInLayout) {
if (keyCount == 1) {
firstPath.position = 1;
}
position = keyCount + 1;
tlLogger.v('path sibling, count: $position');
} else {
if (existingKeys.contains(key)) {
WidgetPath wp = widgetContexts[key];
position = wp.position;
tlLogger.v('Replacing logged widget: $key, position: $position');
} else {
tlLogger.v(
'Removing $keyCount siblings(new key: $key): ...${firstPath.path.substring(max(0, firstPath.path.length - 90))}');
for (int eKey in existingKeys) {
WidgetPath wp = widgetContexts[eKey];
tlLogger.v(
'Removing $eKey, position: ${wp.position}, used: ${wp.usedInLayout}');
removePath(eKey);
}
}
}
}
this.key = key;
widgetContexts[key] = this;
}