targets property

Implementation

Iterable<TextSelectionTarget> get targets {
  if (disposed) return const [];
  appearance = readAppearance();
  final ids = refreshIds();
  final removed = _targets.keys.where((id) => !ids.contains(id)).toList();
  for (final id in removed) {
    _targets.remove(id)!.selectionEnabled = false;
  }
  for (final id in ids) {
    final target = _targets.putIfAbsent(id, () => _NativeTarget(this, id));
    final bounds = readBounds(id);
    target.selectionEnabled = bounds != null;
    if (bounds != null) target.selectionBounds = bounds;
    target.selectionText = readSource(id);
  }
  return ids.map((id) => _targets[id]!);
}