qr_shareable_list 1.0.0
qr_shareable_list: ^1.0.0 copied to clipboard
A complete UI and decoding toolkit for sharing real-time lists via automatically generated QR codes.
qr_shareable_list #
A Flutter package that provides a complete UI and decoding toolkit for sharing real-time lists (like groceries or tasks) via automatically generated QR codes.
✨ Features #
- ShareableListWidget: A plug-and-play UI component that displays a list of items and generates a QR code containing the list's data.
- QrListDecoder: A built-in utility to safely decode scanned QR string data back into a structured format.
- Offline-Ready: Perfect for offline-first sharing or flatmate grocery synchronization without needing a complex backend.
🚀 Getting started #
Add the dependency to your pubspec.yaml file:
dependencies:
qr_shareable_list: ^1.0.0
Run flutter pub get in your terminal to install the package.
💻 Usage
- Displaying the List and Generating the QR Code Import the package and use the ShareableListWidget in your app. It automatically handles the UI and QR code generation.
import 'package:flutter/material.dart'; import 'package:qr_shareable_list/qr_shareable_list.dart';
class GroceryScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Flatmate Groceries')), body: const ShareableListWidget( listTitle: 'Weekly Groceries', initialItems: ['Milk', 'Eggs', 'Bread', 'Coffee'], primaryColor: Colors.deepPurple, ), ); } }
- Decoding a Scanned List When scanning the generated QR code (using any barcode scanner package), simply pass the raw string to the QrListDecoder:
import 'package:qr_shareable_list/qr_shareable_list.dart';
// Example: rawScannedString is the data captured from your camera final rawScannedString = '{"title":"Weekly Groceries","items":["Milk","Eggs"]}';
final decodedList = QrListDecoder.decodeScannedData(rawScannedString);
if (decodedList != null) { print('List Name: ${decodedList['title']}'); print('Items to buy: ${decodedList['items']}'); } else { print('Error: Invalid QR Code data format.'); }
👨💻 Author Developed by Mufaddal Mustafa Bhaijiwala.