-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
action_sheet tests: Cover "Share" button
- Loading branch information
1 parent
4a99e3c
commit f2a847a
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:flutter/services.dart'; | ||
|
||
class MockSharePlus { | ||
MockSharePlus(); | ||
|
||
/// The last string that `shareWithResult` was called with. | ||
String? sharedString; | ||
|
||
Future<Object?> handleMethodCall(MethodCall methodCall) async { | ||
switch (methodCall.method) { | ||
case 'shareWithResult': | ||
// The method channel doesn't preserve Map<String, dynamic> as | ||
// `arguments`'s type; logging runtimeType gives _Map<Object?, Object?>. | ||
final arguments = methodCall.arguments as Map; | ||
sharedString = arguments['text'] as String; | ||
return 'some-success-response'; | ||
default: | ||
throw UnimplementedError(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters