CountryFlag.fromPhoneCode constructor

CountryFlag.fromPhoneCode(
  1. String phoneCode, {
  2. Key? key,
  3. CountryFlagMode mode = CountryFlagMode.emoji,
  4. CountryFlagStyle style = const CountryFlagStyle(),
  5. String unknownFlag = '🏳️',
  6. String svgUrlBuilder(
    1. String countryCode
    )?,
  7. CountryFlagSvgBuilder? svgBuilder,
  8. String? semanticsLabel,
})

Create a flag by phone code (for example +1 or 44).

Implementation

factory CountryFlag.fromPhoneCode(
  String phoneCode, {
  Key? key,
  CountryFlagMode mode = CountryFlagMode.emoji,
  CountryFlagStyle style = const CountryFlagStyle(),
  String unknownFlag = '🏳️',
  String Function(String countryCode)? svgUrlBuilder,
  CountryFlagSvgBuilder? svgBuilder,
  String? semanticsLabel,
}) {
  return CountryFlag(
    key: key,
    country: lookupByPhoneCode(phoneCode),
    mode: mode,
    style: style,
    unknownFlag: unknownFlag,
    svgUrlBuilder: svgUrlBuilder,
    svgBuilder: svgBuilder,
    semanticsLabel: semanticsLabel,
  );
}