Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] HomeWidget.isSupported() #174

Open
nielsbasjes opened this issue Oct 24, 2023 · 0 comments
Open

[Feature] HomeWidget.isSupported() #174

nielsbasjes opened this issue Oct 24, 2023 · 0 comments

Comments

@nielsbasjes
Copy link

Because having a HomeWidget is only supported on certain platforms I propose a new function bool HomeWidget.isSupported() which simply returns if the current runtime of the application supports having a HomeWidget.

This wil make it easier for applications to know if the code fragments that build this widget is to be initialized/called.

I'm not 100% sure but I suspect the code can be as simple as this (perhaps even cache the value)

bool isSupported() {
  if (kIsWeb) {
    return false;
  }
  return (defaultTargetPlatform == TargetPlatform.iOS || defaultTargetPlatform == TargetPlatform.android);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant