iconImage method

Image iconImage(
  1. double dimension
)

Returns an Image widget for the UPI app.

dimension specifies width and height of the Image output.

On Android, it creates an Image widget from the byte-array of the logo. On iOS, it creates an Image widget from logo stored as part of assets.

Implementation

Image iconImage(double dimension) {
  if (io.Platform.isAndroid) {
    return Image.memory(_icon!, width: dimension, height: dimension);
  } else if (io.Platform.isIOS) {
    return Image.asset(
      'assets/apps/ios/${upiApplication.iosBundleId}.png',
      package: 'upi_pay_x',
      width: dimension,
      height: dimension,
    );
  }
  throw UnsupportedError('`iconImage` is available on Android and iOS only');
}