qr_steam 0.2.0 copy "qr_steam: ^0.2.0" to clipboard
qr_steam: ^0.2.0 copied to clipboard

A Flutter plugin for streaming binary data via animated QR codes with sequential chunks or LT fountain codes. Inspired by txqr/QRStream and suitable for camera-based transfer of AVIF images and other [...]

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import 'pages/home_page.dart';
import 'pages/receiver_page.dart';
import 'pages/sender_page.dart';

void main() {
  // 确保 Flutter 引擎初始化(平台插件在 runApp 前需要)
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const QrSteamApp());
}

/// 应用根组件。
/// 根据当前运行平台自动路由到对应页面:
/// - Windows  → 发送端(SenderPage)
/// - Android / iOS / Web → 接收端(ReceiverPage)
/// - 其他平台 → 首页(HomePage)
class QrSteamApp extends StatelessWidget {
  const QrSteamApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'QR Steam Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      // 平台析分到对应初始页面
      home: _initialPage(),
      routes: {
        '/home': (_) => const HomePage(),
        '/sender': (_) => const SenderPage(),
        '/receiver': (_) => const ReceiverPage(),
      },
    );
  }

  /// 根据运行平台返回对应的初始页面。
  /// 使用 [defaultTargetPlatform] 替代 dart:io 的 Platform,兼容 Web。
  Widget _initialPage() {
    if (kIsWeb) return const ReceiverPage(); // Web 直接进接收页(手机浏览器)
    switch (defaultTargetPlatform) {
      case TargetPlatform.windows:
        return const SenderPage(); // Windows 直接进发送页
      case TargetPlatform.android:
      case TargetPlatform.iOS:
        return const ReceiverPage(); // 移动端直接进接收页
      default:
        return const HomePage(); // 其他平台显示首页导航
    }
  }
}
1
likes
140
points
106
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for streaming binary data via animated QR codes with sequential chunks or LT fountain codes. Inspired by txqr/QRStream and suitable for camera-based transfer of AVIF images and other payloads.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter, mobile_scanner, qr_flutter

More

Packages that depend on qr_steam