MethodChannel to mock OpenFile package in flutter for ResultType.noAppToOpen in test

Viewed 145

Currently I am trying to mock the package of OpenFile in Flutter for ResultType.noAppToOpen in the test here

So I did the method channel below.

const MethodChannel('open_file').setMockMethodCallHandler(methodCall) { return OpenResult(message: 'No APP found to open this file.' , type: ResultType.noAppToOpen);

But I am unable to have the desired return of ResultType.noAppToOpen in my test as it is returning me ResultType.error instead. Am I doing the methodChannel wrongly for this since there is filePath inside OpenFile.open(filePath) ? Or is the methodChannel not working for this. Thank you.

0 Answers
Related