getDeviceLocaleCode static method

String getDeviceLocaleCode()

Get the device local code first part, As example 'en' =>'en' 'en_US' => 'en'

Implementation

static String getDeviceLocaleCode() {
  var result = Platform.localeName;
  return result.split('_')[0]; //en_us -- return just en
}