getInstalledWidgets static method

Future<List<HomeWidgetInfo>> getInstalledWidgets()

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.

Implementation

static Future<List<HomeWidgetInfo>> getInstalledWidgets() async {
  final List<dynamic>? result =
      await _channel.invokeMethod('getInstalledWidgets');
  return result
          ?.map(
            (widget) =>
                HomeWidgetInfo.fromMap(widget.cast<String, dynamic>()),
          )
          .toList() ??
      [];
}