filterWhereSelectable<T> static method

bool Function(T) filterWhereSelectable<T>(
  1. Object isMaybeModel, [
  2. bool defaultIfMissingInterface = true
])

Returns a filter function based on item being selectable.

Implementation

static bool Function(T) filterWhereSelectable<T>(
  Object isMaybeModel, [
  bool defaultIfMissingInterface = true,
]) {
  bool Function(T) isSelectable = (_) => defaultIfMissingInterface;
  if (isMaybeModel is Selectable<T>) {
    isSelectable = (option) {
      return identical(
        isMaybeModel.getSelectable(option),
        SelectableOption.Selectable,
      );
    };
  }
  return isSelectable;
}