findFrom method

MustacheSection? findFrom(
  1. String? value
)

checks value if it contains any of the MustacheSection

Implementation

MustacheSection? findFrom(String? value) {
  if (value == null) {
    return null;
  }

  final valueLower = value.toLowerCase();

  for (final e in this) {
    final name = e.name.toLowerCase();

    if (valueLower.startsWith(name)) {
      return e;
    }

    if (e.isInvert) {
      if (valueLower.startsWith('invertsection')) {
        return e;
      }
    }
  }

  return null;
}