Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
## 1.1.0

- Fixed a bug: URL didn't open within the app, but in browser. Solved already

## 2.0.0

- Null-safety
6 changes: 3 additions & 3 deletions lib/src/link_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ class Link extends StatelessWidget {

final Widget child;
final String url;
final VoidCallback onError;
final VoidCallback? onError;

/// In case the URL is not openable (i.e., scheme is not supported in your device), it won't launch the URL and call the onError callback if provided.
/// Otherwise, the URL will be launched within the app
const Link({Key key, @required this.url, @required this.child, this.onError: null}) : super(key: key);
const Link({Key? key, required this.url, required this.child, this.onError}) : super(key: key);

void _launch(String url) async {
if (await Launcher.canLaunch(url)) {
await Launcher.launch(url, forceWebView: true,);
} else {
if (onError != null) {
onError();
onError!();
}
}
}
Expand Down
Loading