getworld 1.1.0 copy "getworld: ^1.1.0" to clipboard
getworld: ^1.1.0 copied to clipboard

A dart package to get countries, languages and currencies data.

example/lib/main.dart

import 'package:getworld/getworld.dart';

void main() async {
  Stopwatch stopwatch = Stopwatch()..start();

  GetWorld().initialize();
  print(Countries.length);
  print(Languages.length);
  print(Currencies.length);

  print('GetWorld.intitialize executed in ${stopwatch.elapsed.inMilliseconds} Milliseconds\n');

  //Find by common/offical name
  stopwatch.reset();
  print(Countries.where((country) => country.name.official.toLowerCase().contains("Egypt".toLowerCase()) || country.name.common.toLowerCase().contains("Egypt".toLowerCase())).map((e) => e.name.common));
  print('Countries.where executed  in ${stopwatch.elapsed.inMilliseconds} Milliseconds\n');

  //Find by calling_code
  stopwatch.reset();
  print(Countries.where((country) => country.dialling!.calling_code.contains("+1")).map((e) => e.name.common));
  print('Countries.where executed  in ${stopwatch.elapsed.inMilliseconds} Milliseconds\n');

  //Find by Currency object
  stopwatch.reset();
  print(Countries.where(
          (country) => country.currencies!.contains(Currencies.firstWhere((cur) => cur.iso_4217_code == "USD")))
      .map((e) => e.name.common));
  print('Countries.where executed  in ${stopwatch.elapsed.inMilliseconds} Milliseconds\n');

  //Find by Currency code
  stopwatch.reset();
  print(Countries.where((country) => country.currencies!.any((currency) => currency.iso_4217_code == "USD"))
      .map((e) => e.name.common));
  print('Countries.where executed  in ${stopwatch.elapsed.inMilliseconds} Milliseconds\n');
}
11
likes
130
pub points
57%
popularity

Publisher

unverified uploader

A dart package to get countries, languages and currencies data.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

collection

More

Packages that depend on getworld