This repository was archived by the owner on Feb 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
packages/url_launcher/url_launcher/lib/src Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,6 @@ import 'package:url_launcher_platform_interface/url_launcher_platform_interface.
1212export 'package:url_launcher_platform_interface/link.dart'
1313 show LinkTarget, LinkWidgetBuilder, FollowLink;
1414
15- Widget defaultLinkDelegate (LinkInfo link) {
16- return DefaultLinkDelegate (link);
17- }
18-
1915/// A widget that renders a real link on the web, and uses WebViews in native
2016/// platforms to open links.
2117///
@@ -66,7 +62,7 @@ class Link extends StatelessWidget implements LinkInfo {
6662 super (key: key);
6763
6864 LinkDelegate get _effectiveDelegate {
69- return UrlLauncherPlatform .instance.linkDelegate ?? defaultLinkDelegate ;
65+ return UrlLauncherPlatform .instance.linkDelegate ?? DefaultLinkDelegate .create ;
7066 }
7167
7268 @override
@@ -83,6 +79,13 @@ class DefaultLinkDelegate extends StatelessWidget {
8379 /// Creates a delegate for the given [link] .
8480 const DefaultLinkDelegate (this .link);
8581
82+ /// Given a [link] , creates an instance of [DefaultLinkDelegate] .
83+ ///
84+ /// This is a static method so it can be used as a tear-off.
85+ static DefaultLinkDelegate create (LinkInfo link) {
86+ return DefaultLinkDelegate (link);
87+ }
88+
8689 /// Information about the link built by the app.
8790 final LinkInfo link;
8891
You can’t perform that action at this time.
0 commit comments