targetToFinder method

Finder targetToFinder(
  1. dynamic target, {
  2. bool skipOffStage = true,
})

Implementation

Finder targetToFinder(dynamic target, {bool skipOffStage = true}) {
  if (target is Finder) {
    return target;
  } else if (target is String) {
    return TextFinder(target, skipOffstage: skipOffStage);
  } else if (target is IconData) {
    return find.byIcon(target, skipOffstage: skipOffStage);
  } else if (target is Key) {
    return find.byKey(target, skipOffstage: skipOffStage);
  } else if (target is Type) {
    return find.byType(target, skipOffstage: skipOffStage);
  } else {
    throw StateError('Unsupported target ${target.runtimeType}');
  }
}