@@ -167,7 +167,16 @@ void main() {
167167 });
168168
169169 test ('withResult methods invoke normal share on non IOS & Android' , () async {
170- await sharePlatform.share (
170+ // Setup mockito to return a raw result instead of null
171+ const success = ShareResult ("raw result" , ShareResultStatus .success);
172+ TestDefaultBinaryMessengerBinding .instance.defaultBinaryMessenger
173+ .setMockMethodCallHandler (MethodChannelShare .channel,
174+ (MethodCall call) async {
175+ await mockChannel.invokeMethod <void >(call.method, call.arguments);
176+ return success.raw;
177+ });
178+
179+ final result = await sharePlatform.share (
171180 ShareParams (
172181 text: 'some text to share' ,
173182 subject: 'some subject to share' ,
@@ -182,9 +191,10 @@ void main() {
182191 'originWidth' : 3.0 ,
183192 'originHeight' : 4.0 ,
184193 }));
194+ expect (result, success);
185195
186196 await withFile ('tempfile-83649e.png' , (File fd) async {
187- await sharePlatform.share (
197+ final result = await sharePlatform.share (
188198 ShareParams (
189199 files: [XFile (fd.path)],
190200 ),
@@ -193,6 +203,7 @@ void main() {
193203 'paths' : [fd.path],
194204 'mimeTypes' : ['image/png' ],
195205 }));
206+ expect (result, success);
196207 });
197208 });
198209}
0 commit comments