पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv0.10.5

workmanager_platform_interface

वर्कमैनेजर प्लगइन के लिए एक सामान्य प्लेटफ़ॉर्म इंटरफ़ेस।

AndroidiOSLinuxmacOSWebWindows
30-दिन डाउनलोड
2.8 लाख
लाइक
0
Pub अंक
150

पैकेज इंस्टॉल करें

flutter pub add workmanager_platform_interface

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

workmanager प्लगइन के लिए एक साझा प्लेटफॉर्म इंटरफ़ेस, जो Android, iOS, Linux, macOS, Web और Windows में समान पृष्ठभूमि कार्य क्रियान्वयन की अनुमति देता है। यह प्लेटफॉर्म-विशिष्ट कार्यान्वयन को अब्स्ट्रैक्ट करता है, जिससे विकासकर्ता एक विश्वसनीय तरीके से पृष्ठभूमि कार्य को योजना बनाने और प्रबंधित करने वाले क्रॉस-प्लेटफॉर्म कोड लिख सकते हैं। इंटरफ़ेस के माध्यम से संगतता सुनिश्चित होती है और एकमात्र API के माध्यम से मूल प्लेटफॉर्म के साथ एकीकरण को सरल बनाया जाता है। यह पैकेज workmanager इकोसिस्टम के लिए मूलभूत है, जो आवधिक कार्यों और एक बार के कार्यों के जैसे विशेषताओं का समर्थन करता है।

उपयोग

  • कई प्लेटफॉर्म पर बैकग्राउंड कार्यों की योजना बनाना
  • पृष्ठभूमि में नियमित कार्यों को चलाएं
  • एक बार के पृष्ठभूमि संचालन का निष्पादन
  • प्लेटफॉर्म के बीच सुसंगतता सुनिश्चित करें
  • लंबे समय तक चलने वाली बैकग्राउंड प्रक्रियाओं का समर्थन करता है

मुख्य विशेषताएँ

  • प्लेटफ़ॉर्म के बीच एकीकृत API
  • प्लेटफॉर्म एबस्ट्रैक्शन लेयर
  • Android, iOS, Linux, macOS, Web और Windows के लिए समर्थन
  • पृष्ठभूमि कार्य योजना बनाने की अनुमति देता है
  • प्लगइन विस्तार को सुगम बनाता है

इनके लिए उपयुक्त

  • पृष्ठभूमि कार्यों के साथ एक्स-प्लेटफॉर्म ऐप्स विकसित करने वाले डेवलपर्स
  • निरंतर पृष्ठभूमि कार्य प्रबंधन की आवश्यकता वाली टीमें
  • workmanager प्लगइन इकोसिस्टम का उपयोग करने वाले प्रोजेक्ट
  • विश्वसनीय आवधिक या एक बार पृष्ठभूमि निष्पादन की आवश्यकता वाले ऐप

विचार योग्य बातें

  • प्लेटफॉर्म-विशिष्ट प्लगइन द्वारा कार्यान्वित करने की आवश्यकता है
  • कन्क्रीट प्लेटफॉर्म के बिना अलग से उपयोग योग्य नहीं है
  • कार्य प्रबंधक पैकेज के कार्यान्वयन के लिए निर्भर है
  • कुछ प्लेटफॉर्म पर अतिरिक्त अनुमतियों की आवश्यकता हो सकती है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

Flutter Workmanager

pub package pub points likes popularity GitHub Workflow Status license

Execute Dart code in the background, even when your app is closed (Android and iOS). On macOS, background tasks run while the app is running or backgrounded and the Mac is awake. Perfect for data sync, file uploads, and periodic maintenance tasks.

⚠️ Experimental web support now exists via workmanager_web (Service Worker + Web Worker based background execution). See the Web (experimental) page and the package README for honest limitations and how to test it in Chrome.

📖 Documentation

Get started with background tasks in Flutter:

→ Quick Start Guide - Installation and setup

→ API Documentation - Complete Dart API reference

→ Debugging Guide - Troubleshooting help

→ Troubleshooting Guide - Why tasks stop after app close (OEM battery optimization, constraints, verification)

🎯 Use Cases

Background tasks are perfect for:

  • Sync data from API - Keep your app's data fresh
  • Upload files in background - Reliable file uploads
  • Clean up old data - Remove old files and cache
  • Fetch notifications - Check for new messages
  • Database maintenance - Optimize and clean databases

⏱ Long-Running Tasks (Android)

For work that takes longer than the regular background execution window (bulk uploads/downloads, ML processing), Android tasks can run as a foreground service with a persistent notification. Pass a foregroundServiceConfig to registerOneOffTask or registerPeriodicTask:

await Workmanager().registerOneOffTask(
  "upload-task",
  "upload_files",
  foregroundServiceConfig: ForegroundServiceConfig(
    notificationTitle: "Uploading files",
    notificationText: "Your files are being uploaded",
  ),
);

See the Quick Start guide for details and platform caveats.

🛑 Cancelling Running Work (Android)

cancelByUniqueName, cancelByTag and cancelAll stop the WorkManager worker immediately, but the Dart callback that is currently running keeps executing unless it reacts to the stop. Pass an onTaskStopped handler to executeTask inside your callbackDispatcher to be notified when a running task is stopped before it finishes:

@pragma('vm:entry-point')
void callbackDispatcher() {
  Workmanager().executeTask(
    (taskName, inputData) async {
      return true;
    },
    onTaskStopped: (taskName, stopReason) async {
      // Mark the task as cancelled / persist state, then return promptly.
    },
  );
}

The handler receives the task name and the WorkManager stop reason (cancelledByApp, timeout, preempt, ...); on Android < 12 the reason is StopReason.unknown. Android-only — iOS has no way to stop a running task. See the Customization guide for details.

🐛 Issues & Support

🚀 Example App

See the example folder for a complete working demo with all task types and platform configurations.

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 2 आइटम

  • meta^1.10.0
  • plugin_platform_interface^2.1.0

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट

अभी कोई डेटा उपलब्ध नहीं है।

रैंकिंग