byField method

List<WhereCondition> byField (
  1. String fieldName,
  2. List<WhereCondition> conditions

Recursively find conditions that evaluate a specific field. A field is a member on a model, such as myUserId in final String myUserId. If the use case for the field only requires one result, say id or primaryKey, firstByField may be more useful.


static List<WhereCondition> byField(String fieldName, List<WhereCondition> conditions) {
  final flattenedConditions = <WhereCondition>[];

  /// recursively flatten all nested conditions
  void expandConditions(WhereCondition condition) {
    if (condition?.conditions == null || condition.conditions.isEmpty) {
    } else {


  return flattenedConditions
      ?.where((c) => c.evaluatedField == fieldName)