assetPickerTextDelegateFromLocale function

AssetPickerTextDelegate assetPickerTextDelegateFromLocale(
  1. Locale? locale
)

Obtain the text delegate from the given locale.

Implementation

AssetPickerTextDelegate assetPickerTextDelegateFromLocale(Locale? locale) {
  if (locale == null) {
    return const AssetPickerTextDelegate();
  }
  final String languageCode = locale.languageCode.toLowerCase();
  for (final AssetPickerTextDelegate delegate in assetPickerTextDelegates) {
    if (delegate.languageCode == languageCode) {
      return delegate;
    }
  }
  return const AssetPickerTextDelegate();
}