HomeWidget class

A Flutter Plugin to simplify setting up and communicating with HomeScreenWidgets

Constructors

HomeWidget()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

groupId String?
The AppGroupId used for iOS Widgets
getter/setter pair
widgetClicked Stream<Uri?>
Receives Updates if App Launched via the Widget
no setter

Static Methods

getInstalledWidgets() Future<List<HomeWidgetInfo>>
On iOS, returns a list of HomeWidgetInfo for each type of widget currently installed, regardless of the number of instances. On Android, returns a list of HomeWidgetInfo for each instance of each widget currently pinned on the home screen. Returns an empty list if no widgets are pinned.
getWidgetData<T>(String id, {T? defaultValue}) Future<T?>
Returns Data saved with saveWidgetData id of Data Saved defaultValue value to use if no data was found
initiallyLaunchedFromHomeWidget() Future<Uri?>
Checks if the App was initially launched via the Widget
isRequestPinWidgetSupported() Future<bool?>
Determines whether pinning HomeScreen Widget is supported.
registerBackgroundCallback(FutureOr<void> callback(Uri?)) Future<bool?>
Register a callback that gets called when clicked on a specific View in a HomeWidget This enables having Interactive Widgets that can call Dart Code More Info on setting this up in the README
registerInteractivityCallback(FutureOr<void> callback(Uri?)) Future<bool?>
Register a callback that gets called when clicked on a specific View in a HomeWidget This enables having Interactive Widgets that can call Dart Code More Info on setting this up in the README
renderFlutterWidget(Widget widget, {required String key, Size logicalSize = const Size(200, 200), double pixelRatio = 1}) Future
Generate a screenshot based on a given widget. This method renders the widget to an image (png) file with the provided filename. The png file is saved to the App Group container and the full path is returned as a string. The filename is saved to UserDefaults using the provided key.
requestPinWidget({String? name, String? androidName, String? qualifiedAndroidName}) Future<void>
Requests to Pin (Add) the HomeScreenWidget to the User's Home Screen
saveWidgetData<T>(String id, T? data) Future<bool?>
Save data to the Widget Storage
setAppGroupId(String groupId) Future<bool?>
Required on iOS to set the AppGroupId groupId in order to ensure communication between the App and the Widget Extension
updateWidget({String? name, String? androidName, String? iOSName, String? qualifiedAndroidName}) Future<bool?>
Updates the HomeScreen Widget