setIconForState method

Future<void> setIconForState(
  1. String assetKey,
  2. BarcodePickState state
)

Implementation

Future<void> setIconForState(String assetKey, BarcodePickState state) {
  return rootBundle.load(assetKey).then((value) {
    var base64EncodedImage = base64Encode(value.buffer.asUint8List());
    // Remove existing item first
    _iconsForState.removeWhere((element) => element.pickState == state);
    _iconsForState.add(new IconForState(state, base64EncodedImage));
  });
}