getByNameOrNull static method

Language? getByNameOrNull(
  1. String name
)

Retrieves a Language instance by its name, or null if not found.

Implementation

static Language? getByNameOrNull(String name) {
  for (final lang in all) {
    final langName = lang.name;
    if (langName.toLowerCase() == name.toLowerCase()) {
      return lang;
    }
  }
  final index = all.indexWhere((l) => l.name == name);
  return index != -1 ? all[index] : null;
}