removeDiacritics static method

String removeDiacritics({
  1. required String source,
})

Implementation

static String removeDiacritics({required String source}) {
  var withDiacritics = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž';
  var withoutDiacritics = 'AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz';

  return source.splitMapJoin('',
      onNonMatch: (char) =>
          char.isNotEmpty && withDiacritics.contains(char) ? withoutDiacritics[withDiacritics.indexOf(char)] : char);
}