setLanguage method

  1. @override
Future<void> setLanguage(
  1. String? language
)
override

Sets the provided language as a preferred localization of IpGeoLocation.

Implementation

@override
Future<void> setLanguage(String? language) async {
  Log.debug('setLanguage($language)', '$runtimeType');

  final bool wasNull = _language == null;
  if (_language != language) {
    _language = language?.split('-').firstOrNull?.split('_').firstOrNull;

    final List<Future> futures = [];
    if (!wasNull) {
      for (var e in sessions) {
        futures.add(e.init());
      }
    }

    await Future.wait(futures);
  }
}