Flutter Library for the iOS WidgetKit framework and Widget Communication

flutter_widgetkit

Flutter library for iOS Widgets Extensions. Integrate a Widget into your App.

This library allows you to call essential methods from the iOS "WidgetKit Framework", which are needed when developing a widget. For example updating the widget timelines. It is also possible to communicate with the widget via App Groups/UserDefaults.

Installation ?‍

Add flutter_widgetkit as a dependency in your pubspec.yaml file.

Usage ??‍?

import 'package:flutter_widgetkit/flutter_widgetkit.dart';

// Reloading Widget Timelines
WidgetKit.reloadAllTimelines();
WidgetKit.reloadTimelines('test');

// Communicate with Widget
WidgetKit.setItem('testString', 'Hello World', 'group.com.fasky');

Methods ?‍

WidgetKit.reloadAllTimelines()

Reloads the timelines for all configured widgets belonging to the containing app.


WidgetKit.reloadTimelines(ofKind: String)

Reloads the timelines for all widgets of a particular kind.


WidgetKit.setItem(String key, dynamic value, String appGroup)

Writes Key-Value to UserDefaults database.


WidgetKit.getItem(String key, String appGroup)

Reads Value from UserDefaults database.

GitHub