skills.vishalvoidskills/vishalvoid
Technical & DevelopmentIntermediate

flutter-adding-home-screen-widgets

Add home screen widgets to Flutter apps on Android and iOS

Developer Setup

Setup & Installation

bash
npx skills add https://github.com/flutter/skills --skill flutter-adding-home-screen-widgets

Overview

What This Skill Does

Add home screen widgets to Flutter apps on Android and iOS

Application

When to use this Skill

Documentation

Show Skills.md file

Implementing Flutter Home Screen Widgets

Contents

Architecture & Data Flow

Home Screen Widgets require native UI implementation (SwiftUI for iOS, XML/Kotlin for Android). The Flutter app communicates with these native widgets via shared local storage (UserDefaults on iOS, SharedPreferences on Android) using the home_widget package.

  • Data Write: Flutter app writes key-value pairs or renders images to a shared container.
  • Trigger: Flutter app signals the native OS to update the widget.
  • Data Read: Native widget wakes up, reads the key-value pairs or images from the shared container, and updates its UI.

Flutter Integration Workflow

Use this checklist to implement the Dart side of the Home Screen Widget integration.

  • Step 1: Initialize the App Group. Call HomeWidget.setAppGroupId('<YOUR_APP_GROUP>') in initState() or app startup.
  • Step 2: Save Data. Use HomeWidget.saveWidgetData<T>('key', value) to write data to shared storage.
  • Step 3: Trigger Update. Call HomeWidget.updateWidget(iOSName: 'YourIOSWidget', androidName: 'YourAndroidWidget') to notify the OS.
  • Step 4: Validate. Run Flutter build -> review console for missing plugin registrations -> fix.
Lines 1 - 25 of 194

Recommendations

Explore other random skills

All skillsMy patterns