decodeMessageFromImageAsync function

Future<DecodeResponse> decodeMessageFromImageAsync (DecodeRequest req, { BuildContext context })

Implementation

Future<DecodeResponse> decodeMessageFromImageAsync(DecodeRequest req,
    {BuildContext context}) async {
  if (context != null) {
    AppRunningState appRunningState =
        Provider.of<AppContext>(context, listen: false).getAppRunningState();
    if (appRunningState == AppRunningState.INTEGRATION_TEST) {
      return getMockedDecodeResult();
    } else {
      final DecodeResponse res = await compute(decodeMessageFromImage, req);
      return res;
    }
  } else {
    final DecodeResponse res = await compute(decodeMessageFromImage, req);
    return res;
  }
}