flutter_unify 1.1.0 copy "flutter_unify: ^1.1.0" to clipboard
flutter_unify: ^1.1.0 copied to clipboard

Unified API for cross-platform Flutter development. One API for all platforms with reactive streams and pluggable adapters.

πŸš€ Flutter Unify - The Ultimate Unified API #

pub package pub points popularity likes License: MIT Flutter Platforms Test Coverage

The "Bloc for Everything Else" - One unified API for auth, networking, storage, AI, and more across all platforms.

Features β€’ Quick Start β€’ Documentation β€’ Examples β€’ Contributing


Flutter Unify is not just another package - it's a complete development platform that provides a single, consistent API surface for all your cross-platform development needs. Think of it as Bloc for everything else - authentication, notifications, storage, networking, AI, and so much more.

🎯 Why Choose Flutter Unify? #

Feature Flutter Unify Firebase Other Packages
Multi-Provider Support βœ… Switch between providers easily ❌ Locked to Firebase ⚠️ Usually single provider
Unified API βœ… One API for all platforms ⚠️ Platform-specific code needed ⚠️ Different APIs per platform
Reactive Streams βœ… Everything is a stream ⚠️ Limited streams ⚠️ Varies by package
AI Integration βœ… Built-in AI capabilities ❌ Requires separate packages ❌ Not available
Bundle Size βœ… Tree-shaking, only include what you need ⚠️ Large SDK ⚠️ Varies
Zero Vendor Lock-in βœ… Switch providers without code changes ❌ Locked to Firebase ⚠️ Usually locked
Developer Tools βœ… Dev dashboard, CLI, debugging tools ⚠️ Limited tools ⚠️ Basic tools
Cross-Platform βœ… iOS, Android, Web, Desktop ⚠️ Mobile-focused ⚠️ Usually platform-specific

🌟 Why Flutter Unify is Legendary #

🧩 One API, All Platforms #

// Authentication - works the same everywhere
await Unify.auth.signInWithGoogle();
await Unify.auth.signInWithApple();
await Unify.auth.signInWithBiometrics();

// Notifications - unified across all platforms
await Unify.notifications.show('Hello World!');

// System monitoring - reactive streams everywhere
Unify.system.onConnectivityChanged.listen((state) {
  print('Network: ${state.description}');
});

πŸ”„ Everything is Reactive #

Just like BlocBuilder for state management, everything in Flutter Unify is stream-based:

// Listen to auth state changes
StreamBuilder<AuthStateChangeEvent>(
  stream: Unify.auth.onAuthStateChanged,
  builder: (context, snapshot) {
    if (snapshot.hasData && snapshot.data!.user != null) {
      return DashboardScreen();
    }
    return LoginScreen();
  },
);

// Monitor battery level
StreamBuilder<BatteryState>(
  stream: Unify.system.onBatteryChanged,
  builder: (context, snapshot) {
    final battery = snapshot.data;
    return Text('Battery: ${battery?.percentage ?? 0}%');
  },
);

πŸ”Œ Pluggable Architecture #

Swap backends without changing a single line of your app code:

// Switch from Firebase to Supabase
Unify.registerAdapter('auth', SupabaseAuthAdapter());

// Use different storage backends
Unify.registerAdapter('storage', HiveStorageAdapter());
Unify.registerAdapter('storage', SqliteStorageAdapter());

// Custom implementations
Unify.registerAdapter('auth', MyCustomAuthAdapter());

πŸ—οΈ Legendary Developer Experience #

Powerful CLI Tools:

# Create a new project with everything set up
dart run flutter_unify:cli create my_app --template=full

# Add features to existing project
dart run flutter_unify:cli add auth notifications storage

# Generate custom adapters
dart run flutter_unify:cli generate adapter --type=auth --name=MyAuthAdapter

# Validate your setup
dart run flutter_unify:cli doctor

# Run cross-platform tests
dart run flutter_unify:cli test --platforms=web,android,ios

πŸš€ Features #

πŸ€– AI Integration (NEW!) #

Built-in AI capabilities with support for multiple providers:

// Initialize AI
await Unify.ai.initialize(
  config: AIAdapterConfig(apiKey: 'your-key'),
  provider: AIProvider.openai,
);

// Simple chat
final response = await Unify.ai.chat('Explain Flutter in one sentence');

// Advanced usage with streaming
await for (final chunk in Unify.ai.streamChat('Tell me a story')) {
  print(chunk); // Real-time responses
}

// Multi-provider with automatic fallback
Unify.ai.addFallback(anthropicAdapter); // Falls back if OpenAI fails

Supported Providers:

  • βœ… OpenAI (GPT-3.5, GPT-4, GPT-4 Vision)
  • βœ… Anthropic Claude (Opus, Sonnet, Haiku)
  • πŸ”„ Google Gemini (Coming soon)
  • πŸ”„ Local LLMs (Coming soon)

πŸ”Ή Web Enhancements #

Smart Bundling & Compression

  • Advanced tree-shaking & compression strategies (leveraging esbuild/rollup under the hood)
  • Splits core Flutter engine from app logic β†’ only downloads once, cached separately
  • Intelligent code splitting for optimal loading performance

SEO-friendly Rendering Layer

  • Hybrid rendering: Canvas for UI but also exports semantic HTML "ghost DOM" for crawlers
  • Works like a built-in version of seo_renderer, but official and maintained
  • Automatic meta tag generation and structured data support

Progressive Loading (Lite Mode)

  • Ships a lightweight HTML/JS "skeleton" that loads instantly on low-bandwidth
  • Flutter app hydrates later for full functionality
  • Think of it like Next.js SSR β†’ but for Flutter

Cross-browser Polyfills

  • Provides stable wrappers for APIs (FileSystem, Bluetooth, WebRTC) with graceful fallbacks
  • Consistent behavior across all modern browsers

πŸ”Ή Desktop Enhancements #

Unified System Menus & Tray API

  • One API β†’ maps to macOS menu bar, Windows system tray, Linux DBus indicators
  • Global shortcuts supported out of the box
  • Context menus with native look and feel

Native Drag & Drop

  • First-class drag-drop API (text, files, URLs) that works consistently across macOS/Win/Linux
  • Custom drag indicators and drop zones
  • Multi-selection support

Window & Multi-monitor Manager

  • Advanced window snapping, tiling, multi-window support
  • Auto-detects OS capabilities (Aero Snap on Windows, Mission Control on macOS)
  • Per-monitor DPI awareness

System Services Bridge

  • Clipboard, notifications, file dialogs, screen capture β†’ exposed via one stable API
  • No need to import 5+ separate packages
  • Native system integration without complexity

πŸ“¦ Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_unify: ^0.1.0

Then run:

flutter pub get

🎯 Quick Start #

Basic Setup #

import 'package:flutter_unify/flutter_unify.dart';

void main() async {
  // Initialize Flutter Unify
  await Unify.initialize();
  
  runApp(MyApp());
}

Cross-Platform System Operations #

import 'package:flutter_unify/flutter_unify.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return UnifiedScaffold(
      body: ElevatedButton(
        onPressed: () async {
          // Works on all platforms
          await Unify.system.clipboardWriteText('Hello World!');
          await Unify.system.showNotification(
            title: 'Success',
            body: 'Text copied to clipboard!',
          );
        },
        child: Text('Copy to Clipboard'),
      ),
    );
  }
}

Platform-Specific Features #

class PlatformSpecificFeatures extends StatefulWidget {
  @override
  _PlatformSpecificFeaturesState createState() => _PlatformSpecificFeaturesState();
}

class _PlatformSpecificFeaturesState extends State<PlatformSpecificFeatures> {
  @override
  void initState() {
    super.initState();
    _setupPlatformFeatures();
  }
  
  void _setupPlatformFeatures() async {
    // Web-specific optimizations
    if (PlatformDetector.isWeb) {
      Unify.web.seo.setPageTitle('My Flutter App');
      Unify.web.seo.setPageDescription('A unified Flutter experience');
      await Unify.web.progressiveLoader.initialize();
    }
    
    // Desktop integration
    if (PlatformDetector.isDesktop) {
      await Unify.desktop.systemTray.create(
        icon: 'assets/tray_icon.png',
        tooltip: 'My Flutter App',
      );
      
      await Unify.desktop.shortcuts.register(
        'Ctrl+Shift+A',
        () => print('Global shortcut activated!'),
      );
    }
    
    // Mobile features
    if (PlatformDetector.isMobile) {
      final deviceInfo = await Unify.mobile.deviceInfo.getDeviceInfo();
      print('Running on: ${deviceInfo.model}');
    }
  }
  
  @override
  Widget build(BuildContext context) {
    return UnifiedScaffold(
      enableDragAndDrop: true,
      onFilesDropped: (files) => print('Files dropped: ${files.length}'),
      body: PlatformAdaptiveWidget(
        mobile: Text('Mobile UI'),
        web: Text('Web UI'),
        desktop: Text('Desktop UI'),
        fallback: Text('Universal UI'),
      ),
    );
  }
}

πŸ“š Documentation #

🎬 Examples #

Real-World Usage #

// Complete app example
import 'package:flutter_unify/flutter_unify.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize with AI support
  await Unify.initialize();
  await Unify.ai.initialize(
    config: AIAdapterConfig(apiKey: 'your-key'),
  );
  
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: StreamBuilder<AuthStateChangeEvent>(
        stream: Unify.auth.onAuthStateChanged,
        builder: (context, snapshot) {
          if (snapshot.hasData?.user != null) {
            return DashboardScreen();
          }
          return LoginScreen();
        },
      ),
    );
  }
}

Showcase Apps #

πŸ† Why Developers Love Flutter Unify #

  • ⚑ Fast: Optimized for performance, minimal overhead
  • πŸ”’ Reliable: Comprehensive error handling, graceful degradation
  • 🎨 Beautiful: Clean, intuitive API design
  • πŸ“š Well-Documented: Extensive docs, examples, and guides
  • 🀝 Community-Driven: Built by developers, for developers
  • πŸ”„ Actively Maintained: Regular updates and new features

🀝 Contributing #

Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.

πŸ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support & Community #

🀝 Contributing #

We welcome contributions! See our Contributing Guide for details.

Quick Contribution Ideas:

  • 🎨 Create adapters for popular services (Firebase, Supabase, AWS)
  • πŸ“ Improve documentation
  • πŸ› Fix bugs
  • ✨ Add new features
  • πŸ§ͺ Write tests

πŸ“Š Project Status #

  • βœ… Core Features: Complete and stable
  • βœ… AI Integration: OpenAI & Anthropic support
  • βœ… Cross-Platform: iOS, Android, Web, Desktop
  • πŸ”„ Firebase Adapter: In progress
  • πŸ”„ Dev Dashboard: Coming soon
  • πŸ”„ More AI Providers: Gemini, Local LLMs planned

⭐ Star History #

If you find Flutter Unify useful, please consider giving it a ⭐ on GitHub!

πŸ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❀️ by the Flutter community

⬆ Back to Top