Skip to content

Instantly share code, notes, and snippets.

@RemeJuan
Last active June 12, 2021 05:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RemeJuan/dc09ef02c6fe4301b59de866854b5a0d to your computer and use it in GitHub Desktop.
Save RemeJuan/dc09ef02c6fe4301b59de866854b5a0d to your computer and use it in GitHub Desktop.
Unit Testing a Utility function that returns a Widget (Code)
dynamic launchURL(BuildContext context, String url) async {
if (url == 'about:blank') return;
if (url.startsWith('internal://')) {
final isGroups = url.contains('/groups');
if (isGroups) return _handleUnsupported(context);
}
}
void _handleUnsupported(BuildContext context) {
SnackBarUtil.error(
context: context,
message: LocalePathUtils.errorsLocalePath('unknownRoute'),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment