Account Management
ShipFlutter provides a comprehensive account management system that handles user authentication, payments, consent and settings. The account system is built on top of Firebase Authentication and RevenueCat for mobile or LemonSqueezy for web.
Account Structure
The account system is divided into three main components:
- Account: Handles user identity and basic profile information (setup)
- Payments: Manages subscriptions and entitlements (setup)
- Consent: Manages user consent for data collection (setup)
- Settings & Preferences: User preferences and app configuration
User Identity
Each user account is associated with:
- Unique identifier
- Authentication method (email, social, anonymous)
- Basic profile (name, email, avatar)
- Entitlements (active subscriptions)
User Consent Management
ShipFlutter includes a consent management system that allows users to control their data privacy preferences:
The consent system provides:
- Customizable consent banner
- Granular privacy controls
- Persistence across sessions
- Integration with analytics and advertising
Settings Management
The settings system provides a flexible way to manage user preferences:
Available Settings
- Theme preferences (system, light, dark)
- Account information
- Privacy and consent controls
- Subscription management
Implementation
The settings system uses a controller-service pattern:
settings_controller.dart
: Manages the UI state and user interactionssettings_service.dart
: Handles the persistence of settingssettings_view.dart
: Displays the settings UI
Account and Payments Integration
ShipFlutter seamlessly integrates user accounts with the payment system:
-
Account Creation
- Users can start with anonymous accounts
- Upgrade to full accounts when needed
- Social auth providers supported
-
Payment Integration
- RevenueCat handles subscriptions for mobile
- LemonSqueezy handles subscriptions for web
- Webhooks integration for both
- Cross-platform purchase sync
-
Account State
Get and track account state in your app using the
AccountService
and theAccount
class:
Best Practices
-
Account Management
- Always check
account.hasActiveEntitlement()
before accessing premium features - Use the account stream to react to changes in real-time
- Handle anonymous accounts appropriately
- Always check
-
User Privacy
- Always respect user consent settings
- Only collect necessary data
- Provide clear privacy controls
-
Settings
- Keep settings synchronized across devices
- Provide defaults for all settings
- Handle settings changes gracefully