Region.fromPlatform constructor

Region.fromPlatform()

Fetches the region from the PlatformDispatcher.

Defaults to Region.empty when there is no specified platform region.

Implementation

factory Region.fromPlatform() {
  final localeCountryCode = PlatformDispatcher.instance.locale.countryCode;
  if (localeCountryCode == null) return Region.empty;
  return Region(regionalCode: localeCountryCode.toLowerCase());
}