luqta_sdk 1.1.0
luqta_sdk: ^1.1.0 copied to clipboard
Official Luqta Flutter SDK for contests, quizzes, rewards & gamification. Dual-mode support (auto-rendered UI or custom API). 95% Web SDK parity. Production-ready.
Luqta Flutter SDK #
Official Flutter SDK for the Luqta API - Integrate contests, quizzes, rewards, and gamification features into your Flutter applications.
Version: 1.0.0
Features #
Core Features #
- Flexible user identification (email OR phone number)
- Automatic validation of email and international phone number formats
- Consistent error handling across all API responses
- Support for both development and production environments
- Automatic authentication token management with secure storage
- Type-safe HTTP methods (GET, POST, PUT, PATCH, DELETE)
- Request deduplication and rate limiting for security
Contest Management #
- Browse and filter contests (trending, premium, recent)
- Participate in public and private contests
- Track contest progress and completion status
- Access contest details with user-specific progress
- Server-side pagination support
Level Completion #
Support for multiple level types:
- Text Levels: Display and confirm text content
- QR Levels: Scan QR codes for validation
- Link Levels: Open and validate external links
- Image Levels: Upload images for verification
- Quiz Levels: Complete quizzes with instant feedback
Rewards & Gamification #
- Track user points and rewards
- View available rewards and redemption options
- Leaderboard integration
- Achievement tracking
Built-in UI Components #
- Pre-built screens for contests, levels, and quizzes
- Customizable widgets for contest cards and level items
- Theming and branding customization
- Multi-language support (English, Arabic)
- RTL support
Installation #
Add this to your pubspec.yaml:
```yaml dependencies: luqta_sdk: ^1.0.0 ```
Then run:
```bash flutter pub get ```
Quick Start #
1. Import the SDK #
```dart import 'package:luqta_sdk/luqta_sdk.dart'; ```
2. Initialize the SDK #
```dart final client = LuqtaClient( config: LuqtaConfig( apiKey: 'lq_dev_app_xxx', appId: 'your-app-id', user: LuqtaUser(email: 'user@example.com'), ), );
await client.initializeSdk(); ```
3. Sync and Initialize User #
```dart await client.syncUser(UserProfile( name: 'John Doe', email: 'john@example.com', policyAccept: true, ));
await client.initializeUser(); ```
4. Use the API #
```dart final contests = await client.contests.getAll(); final details = await client.contests.getById(contestId); await client.levels.complete(levelId, data: {'answer': 'value'}); ```
Usage Modes #
Custom Mode (API-only) #
```dart final client = LuqtaClient(config: config); await client.initializeSdk(); await client.syncAndInitializeUser(userData);
final contests = await client.contests.getAll(); final levels = await client.levels.getByContest(contestId); ```
Preconfigured Mode (with UI) #
```dart Navigator.push( context, MaterialPageRoute( builder: (context) => ContestsScreen( onFetchContests: ({page, limit}) async { final response = await client.contests.getAll(page: page, perPage: limit); return response.items; }, onContestTap: (contest) { // Handle contest selection }, ), ), ); ```
License #
MIT License - See LICENSE file for details.
Support #
- GitHub: https://github.com/luqta/luqta-flutter-sdk
- Email: support@luqta.com