buildFlagIconForFinancialInstrument function

Widget? buildFlagIconForFinancialInstrument(
  1. String instrument, {
  2. Widget flagIconBuilder(
    1. String
    )?,
  3. bool hasShadow = true,
  4. double? height,
  5. double? width,
})

Implementation

Widget? buildFlagIconForFinancialInstrument(
  String instrument, {
  Widget Function(String)? flagIconBuilder,
  bool hasShadow = true,
  double? height,
  double? width,
}) {
  final iconKey = toCamelCase(instrument);

  final isCountry = kFastImageFlagMap.containsKey(iconKey);

  if (isCountry) {
    return buildFlagIconForCountry(
      instrument,
      flagIconBuilder: flagIconBuilder,
      hasShadow: hasShadow,
      height: height,
      width: width,
    );
  }

  final isCommodity = kFastImageCommodityMap.containsKey(iconKey);

  if (isCommodity) {
    return buildFlagIconForCommodity(
      instrument,
      flagIconBuilder: flagIconBuilder,
      hasShadow: hasShadow,
      height: height,
      width: width,
    );
  }

  final isCrypto = kFastImageCryptoMap.containsKey(iconKey);

  if (isCrypto) {
    return buildFlagIconForCrypto(
      instrument,
      flagIconBuilder: flagIconBuilder,
      hasShadow: hasShadow,
      height: height,
      width: width,
    );
  }

  debugLog('No flag icon found for instrument: $instrument');

  return null;
}