### Install and Activate Very Good CLI Source: https://context7.com/solido/awesome-flutter/llms.txt Install the Very Good CLI package globally using dart pub, enabling access to the very_good command-line tool for scaffolding Flutter and Dart projects with best practices and recommended project structures. ```bash dart pub global activate very_good_cli ``` -------------------------------- ### Flutter State Management with BLoC, Riverpod, and GetX Source: https://context7.com/solido/awesome-flutter/llms.txt Demonstrates state management patterns in Flutter using BLoC, Riverpod, and GetX. Each pattern requires specific dependencies. BLoC uses `flutter_bloc`, Riverpod uses `flutter_riverpod`, and GetX uses `get`. These examples show basic counter implementations with increment functionality. ```dart // BLoC Pattern dependencies: flutter_bloc: ^latest_version import 'package:flutter_bloc/flutter_bloc.dart'; class CounterCubit extends Cubit { CounterCubit() : super(0); void increment() => emit(state + 1); void decrement() => emit(state - 1); } // Usage in widget class CounterPage extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( create: (_) => CounterCubit(), child: BlocBuilder( builder: (context, count) { return Column( children: [ Text('Count: $count'), ElevatedButton( onPressed: () => context.read().increment(), child: Text('Increment'), ), ], ); }, ), ); } } // Riverpod Pattern dependencies: flutter_riverpod: ^latest_version import 'package:flutter_riverpod/flutter_riverpod.dart'; final counterProvider = StateProvider((ref) => 0); class CounterWidget extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final count = ref.watch(counterProvider); return Column( children: [ Text('Count: $count'), ElevatedButton( onPressed: () => ref.read(counterProvider.notifier).state++, child: Text('Increment'), ), ], ); } } // GetX Pattern dependencies: get: ^latest_version import 'package:get/get.dart'; class CounterController extends GetxController { var count = 0.obs; void increment() => count++; } // Usage class CounterPage extends StatelessWidget { final CounterController controller = Get.put(CounterController()); @override Widget build(BuildContext context) { return Obx(() => Column( children: [ Text('Count: ${controller.count}'), ElevatedButton( onPressed: controller.increment, child: Text('Increment'), ), ], )); } } ``` -------------------------------- ### FVM - Flutter Version Management Source: https://context7.com/solido/awesome-flutter/llms.txt FVM (Flutter Version Management) CLI tool enables installation and switching between multiple Flutter versions per project. Supports installing specific versions, listing installed versions, and running Flutter commands with a designated version. Installed via dart pub global activate. ```bash # Install FVM dart pub global activate fvm # Install a Flutter version fvm install 3.16.0 # Use a specific Flutter version for a project fvm use 3.16.0 # List installed versions fvm list # Run Flutter commands with FVM fvm flutter pub get fvm flutter run ``` -------------------------------- ### Flutter UI Components: Shadcn and Forui Examples Source: https://context7.com/solido/awesome-flutter/llms.txt Demonstrates the usage of Shadcn UI and Forui libraries for building user interfaces in Flutter. Includes dependency information and basic component examples like buttons. Assumes the latest version of the libraries are used. ```dart // Using Shadcn UI components dependencies: flutter_shadcn_ui: ^latest_version // Example: Creating a custom button with Shadcn style import 'package:flutter_shadcn_ui/flutter_shadcn_ui.dart'; Widget build(BuildContext context) { return ShadButton( onPressed: () => print('Button pressed'), child: Text('Click me'), ); } // Using Forui for minimalistic UI dependencies: forui: ^latest_version import 'package:forui/forui.dart'; Widget build(BuildContext context) { return FButton( label: 'Submit', onPressed: () { // Handle submission }, ); } ``` -------------------------------- ### Create Flutter Projects and Packages with Very Good CLI Source: https://context7.com/solido/awesome-flutter/llms.txt Generate new Flutter apps, Flutter packages, Dart packages, and Flame games using Very Good CLI templates. These commands scaffold project structures with best practices, testing setup, and architectural patterns pre-configured. ```bash very_good create flutter_app my_app very_good create flutter_package my_package very_good create dart_package my_package very_good create flame_game my_game ``` -------------------------------- ### Firebase Authentication Example in Dart Source: https://context7.com/solido/awesome-flutter/llms.txt Demonstrates Firebase email/password authentication. Requires firebase_auth and firebase_core dependencies. Initializes Firebase and provides a function to sign in users. ```dart // Firebase Authentication dependencies: firebase_auth: ^latest_version firebase_core: ^latest_version import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_core/firebase_core.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); runApp(MyApp()); } // Email/Password Sign In Future signInWithEmailPassword(String email, String password) async { try { final credential = await FirebaseAuth.instance.signInWithEmailAndPassword( email: email, password: password, ); return credential; } on FirebaseAuthException catch (e) { if (e.code == 'user-not-found') { print('No user found for that email.'); } else if (e.code == 'wrong-password') { print('Wrong password provided.'); } return null; } } ``` -------------------------------- ### Flutter Navigation with GoRouter and AutoRoute Source: https://context7.com/solido/awesome-flutter/llms.txt Provides examples for implementing navigation in Flutter using GoRouter and AutoRoute. GoRouter offers declarative routing with `GoRoute` and programmatic navigation using `context.go`. AutoRoute uses code generation, requiring `auto_route_generator` and `build_runner` for route generation. Both solutions integrate with `MaterialApp.router`. ```dart // GoRouter - Declarative routing dependencies: go_router: ^latest_version import 'package:go_router/go_router.dart'; final router = GoRouter( routes: [ GoRoute( path: '/', builder: (context, state) => HomeScreen(), ), GoRoute( path: '/details/:id', builder: (context, state) { final id = state.pathParameters['id']!; return DetailsScreen(id: id); }, ), ], ); // Usage in MaterialApp MaterialApp.router( routerConfig: router, title: 'My App', ); // Navigate programmatically context.go('/details/123'); // AutoRoute - Code generation based routing dependencies: auto_route: ^latest_version dev_dependencies: auto_route_generator: ^latest_version build_runner: ^latest_version import 'package:auto_route/auto_route.dart'; @MaterialAutoRouter( replaceInRouteName: 'Page,Route', routes: [ AutoRoute(page: HomePage, initial: true), AutoRoute(page: DetailsPage), ], ) class $AppRouter {} // Generate routes // Run: flutter pub run build_runner build // Usage final _appRouter = AppRouter(); MaterialApp.router( routerDelegate: _appRouter.delegate(), routeInformationParser: _appRouter.defaultRouteParser(), ); ``` -------------------------------- ### Geolocator Plugin Example in Dart Source: https://context7.com/solido/awesome-flutter/llms.txt Fetches the current device location using the geolocator plugin. Handles location service and permission requests. Requires geolocator and permission_handler dependencies. ```dart // Geolocator Plugin dependencies: geolocator: ^latest_version permission_handler: ^latest_version import 'package:geolocator/geolocator.dart'; Future getCurrentLocation() async { bool serviceEnabled; LocationPermission permission; serviceEnabled = await Geolocator.isLocationServiceEnabled(); if (!serviceEnabled) { return null; } permission = await Geolocator.checkPermission(); if (permission == LocationPermission.denied) { permission = await Geolocator.requestPermission(); if (permission == LocationPermission.denied) { return null; } } if (permission == LocationPermission.deniedForever) { return null; } return await Geolocator.getCurrentPosition( desiredAccuracy: LocationAccuracy.high, ); } // Usage final position = await getCurrentLocation(); if (position != null) { print('Latitude: ${position.latitude}, Longitude: ${position.longitude}'); } ``` -------------------------------- ### Local Authentication (Biometrics) Example in Dart Source: https://context7.com/solido/awesome-flutter/llms.txt Implements local biometric authentication using the local_auth plugin. Checks device support and prompts the user for authentication. Requires the local_auth dependency. ```dart // Local Authentication (Biometrics) dependencies: local_auth: ^latest_version import 'package:local_auth/local_auth.dart'; class BiometricAuth { final LocalAuthentication auth = LocalAuthentication(); Future authenticateWithBiometrics() async { try { final bool canAuthenticateWithBiometrics = await auth.canCheckBiometrics; final bool canAuthenticate = canAuthenticateWithBiometrics || await auth.isDeviceSupported(); if (!canAuthenticate) { return false; } return await auth.authenticate( localizedReason: 'Please authenticate to access this feature', options: const AuthenticationOptions( stickyAuth: true, biometricOnly: true, ), ); } catch (e) { print('Error: $e'); return false; } } } ``` -------------------------------- ### Generate and Run Flutter App Flavors Source: https://context7.com/solido/awesome-flutter/llms.txt Generate flavor configurations using flutter_flavorizr and run the app with specific flavors pointing to different entry points (main_dev.dart, main_prod.dart). This approach allows testing different app variants without rebuilding the entire configuration. ```bash flutter pub run flutter_flavorizr flutter run --flavor dev -t lib/main_dev.dart flutter run --flavor prod -t lib/main_prod.dart ``` -------------------------------- ### Flutter Audio Playback with audioplayers Source: https://context7.com/solido/awesome-flutter/llms.txt Demonstrates how to play audio from network URLs or local assets using the audioplayers plugin. Includes service class for playback control (play, pause, stop) and a sample widget for UI integration. Requires adding 'audioplayers' to pubspec.yaml. ```dart // Audio Players Plugin dependencies: audioplayers: ^latest_version import 'package:audioplayers/audioplayers.dart'; class AudioPlayerService { final AudioPlayer player = AudioPlayer(); Future playFromUrl(String url) async { await player.play(UrlSource(url)); } Future playFromAsset(String assetPath) async { await player.play(AssetSource(assetPath)); } Future pause() async { await player.pause(); } Future stop() async { await player.stop(); } void dispose() { player.dispose(); } } // Usage with state management class AudioPlayerWidget extends StatefulWidget { @override _AudioPlayerWidgetState createState() => _AudioPlayerWidgetState(); } class _AudioPlayerWidgetState extends State { final AudioPlayerService _audioService = AudioPlayerService(); bool isPlaying = false; @override Widget build(BuildContext context) { return Column( children: [ IconButton( icon: Icon(isPlaying ? Icons.pause : Icons.play_arrow), onPressed: () async { if (isPlaying) { await _audioService.pause(); } else { await _audioService.playFromAsset('audio/song.mp3'); } setState(() => isPlaying = !isPlaying); }, ), ], ); } @override void dispose() { _audioService.dispose(); super.dispose(); } } ``` -------------------------------- ### Sqflite: Local SQLite Database Management in Flutter Source: https://context7.com/solido/awesome-flutter/llms.txt This snippet demonstrates how to set up and manage a local SQLite database using the sqflite package in Flutter. It includes dependencies, database initialization, table creation, and CRUD operations for notes. It requires the 'sqflite' and 'path' packages. ```dart // Sqflite - SQLite database dependencies: sqflite: ^latest_version path: ^latest_version import 'package:sqflite/sqflite.dart'; import 'package:path/path.dart'; class DatabaseHelper { static final DatabaseHelper instance = DatabaseHelper._init(); static Database? _database; DatabaseHelper._init(); Future get database async { if (_database != null) return _database!; _database = await _initDB('notes.db'); return _database!; } Future _initDB(String filePath) async { final dbPath = await getDatabasesPath(); final path = join(dbPath, filePath); return await openDatabase( path, version: 1, onCreate: _createDB, ); } Future _createDB(Database db, int version) async { await db.execute(''' CREATE TABLE notes ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, content TEXT NOT NULL, created_at TEXT NOT NULL ) '''); } Future createNote(Map note) async { final db = await database; return await db.insert('notes', note); } Future>> getAllNotes() async { final db = await database; return await db.query('notes', orderBy: 'created_at DESC'); } Future updateNote(int id, Map note) async { final db = await database; return await db.update( 'notes', note, where: 'id = ?', whereArgs: [id], ); } Future deleteNote(int id) async { final db = await database; return await db.delete( 'notes', where: 'id = ?', whereArgs: [id], ); } Future close() async { final db = await database; db.close(); } } // Usage example void main() async { WidgetsFlutterBinding.ensureInitialized(); final dbHelper = DatabaseHelper.instance; // Create a note final noteId = await dbHelper.createNote({ 'title': 'My First Note', 'content': 'This is the content', 'created_at': DateTime.now().toIso8601String(), }); // Read all notes final notes = await dbHelper.getAllNotes(); for (var note in notes) { print('Note: ${note['title']} - ${note['content']}'); } // Update a note await dbHelper.updateNote(noteId, { 'title': 'Updated Title', 'content': 'Updated content', 'created_at': DateTime.now().toIso8601String(), }); // Delete a note await dbHelper.deleteNote(noteId); } ``` -------------------------------- ### Patrol - Integration testing with screenshots Source: https://context7.com/solido/awesome-flutter/llms.txt Patrol test integration demonstrating screenshot capture at multiple stages of a login flow. Captures initial screen, filled credentials state, and final home screen. Enables visual verification and regression testing of UI states throughout user interactions. ```dart patrolTest( 'login flow with screenshots', ($) async { await $.pumpWidgetAndSettle(MyApp()); // Take initial screenshot await $.native.takeScreenshot('login_screen'); // Fill in credentials await $(#emailField).enterText('user@example.com'); await $(#passwordField).enterText('password123'); await $.native.takeScreenshot('filled_credentials'); // Submit login await $(#loginButton).tap(); // Wait for home screen await $.waitUntilVisible($(#homeScreen)); await $.native.takeScreenshot('home_screen'); }, ); ``` -------------------------------- ### FlutterGen - pubspec.yaml configuration and code generation Source: https://context7.com/solido/awesome-flutter/llms.txt FlutterGen configuration in pubspec.yaml specifies output directory, line length, and asset integrations for SVG and Flare support. Code generation via build_runner creates type-safe asset references eliminating runtime asset errors. ```yaml dev_dependencies: flutter_gen_runner: ^latest_version build_runner: ^latest_version flutter_gen: output: lib/gen/ line_length: 80 integrations: flutter_svg: true flare_flutter: true ``` ```bash flutter pub run build_runner build ``` -------------------------------- ### Awesome Flutter Badge Markdown Source: https://github.com/solido/awesome-flutter/blob/master/contributing.md This Markdown snippet represents the Awesome Flutter badge, commonly used in GitHub repositories. It includes a link to the project's GitHub repository and an image tag for the badge, which is dynamically generated using shields.io. ```markdown Awesome Flutter ``` -------------------------------- ### Flutter Video Playback with Chewie and video_player Source: https://context7.com/solido/awesome-flutter/llms.txt Provides a reusable Flutter widget for playing videos from network URLs using the video_player and Chewie packages. Handles video initialization, playback controls, and lifecycle management. Requires 'video_player' and 'chewie' dependencies in pubspec.yaml. ```dart // Video Player with Chewie dependencies: video_player: ^latest_version chewie: ^latest_version import 'package:video_player/video_player.dart'; import 'package:chewie/chewie.dart'; class VideoPlayerScreen extends StatefulWidget { final String videoUrl; VideoPlayerScreen({required this.videoUrl}); @override _VideoPlayerScreenState createState() => _VideoPlayerScreenState(); } class _VideoPlayerScreenState extends State { late VideoPlayerController _videoPlayerController; ChewieController? _chewieController; @override void initState() { super.initState(); initializePlayer(); } Future initializePlayer() async { _videoPlayerController = VideoPlayerController.network(widget.videoUrl); await _videoPlayerController.initialize(); _chewieController = ChewieController( videoPlayerController: _videoPlayerController, autoPlay: true, looping: false, materialProgressColors: ChewieProgressColors( playedColor: Colors.blue, handleColor: Colors.blueAccent, backgroundColor: Colors.grey, bufferedColor: Colors.lightBlue, ), ); setState(() {}); } @override Widget build(BuildContext context) { return _chewieController != null && _chewieController!.videoPlayerController.value.isInitialized ? Chewie(controller: _chewieController!) : Center(child: CircularProgressIndicator()); } @override void dispose() { _videoPlayerController.dispose(); _chewieController?.dispose(); super.dispose(); } } ``` -------------------------------- ### Patrol - Enhanced Flutter integration testing with native interactions Source: https://context7.com/solido/awesome-flutter/llms.txt Patrol framework extends Flutter testing with enhanced finders, native integration capabilities, and screenshot support. Enables finding widgets by type/ID, tapping elements, entering text, and interacting with native features like notifications. Requires patrol and patrol_finders packages. ```dart import 'package:patrol/patrol.dart'; void main() { patrolTest( 'counter increments smoke test', ($) async { await $.pumpWidgetAndSettle(MyApp()); // Find and tap the increment button await $(FloatingActionButton).tap(); // Verify counter incremented expect($(#counterText).text, '1'); // Tap multiple times await $(FloatingActionButton).tap(); await $(FloatingActionButton).tap(); expect($(#counterText).text, '3'); // Native integration - open notification shade (Android) await $.native.openNotifications(); // Verify notification exists await $.native.tap(Selector(text: 'New message')); }, ); } ``` -------------------------------- ### Lottie Animations - Asset and network-based animations Source: https://context7.com/solido/awesome-flutter/llms.txt Lottie library enables playback of JSON-based animations from local assets or network URLs with customizable dimensions and fitting. Supports both Lottie.asset() for local files and Lottie.network() for remote animations. Requires lottie package dependency. ```dart import 'package:lottie/lottie.dart'; class LottieAnimationWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Column( children: [ // From assets Lottie.asset( 'assets/animations/loading.json', width: 200, height: 200, fit: BoxFit.fill, ), // From network Lottie.network( 'https://assets10.lottiefiles.com/packages/lf20_UJNc2t.json', width: 200, height: 200, ), ], ); } } ``` -------------------------------- ### Flutter Animate - Simple animations with chaining Source: https://context7.com/solido/awesome-flutter/llms.txt Flutter Animate library enables simple, chainable animations for text and containers with effects like fadeIn, slide, scale, and shake. Dependencies required: flutter_animate package. Supports duration customization and sequential animation chaining with then() method. ```dart import 'package:flutter_animate/flutter_animate.dart'; Widget build(BuildContext context) { return Column( children: [ Text('Hello World') .animate() .fadeIn(duration: 600.ms) .then(delay: 200.ms) .slide(), Container( width: 100, height: 100, color: Colors.blue, ) .animate() .scale(duration: 300.ms) .then() .shake(duration: 400.ms), ], ); } ``` -------------------------------- ### AnimatedTextKit - Text animations with typewriter, fade, and rotate effects Source: https://context7.com/solido/awesome-flutter/llms.txt AnimatedTextKit provides multiple text animation types including TypewriterAnimatedText, FadeAnimatedText, and RotateAnimatedText with customizable styling, duration, and repetition. Supports tap interactions and full-text display options. Requires animated_text_kit package dependency. ```dart import 'package:animated_text_kit/animated_text_kit.dart'; Widget build(BuildContext context) { return Column( children: [ // Typewriter effect AnimatedTextKit( animatedTexts: [ TypewriterAnimatedText( 'Hello World!', textStyle: TextStyle(fontSize: 32, fontWeight: FontWeight.bold), speed: Duration(milliseconds: 200), ), ], totalRepeatCount: 4, pause: Duration(milliseconds: 1000), displayFullTextOnTap: true, stopPauseOnTap: true, ), // Fade animation AnimatedTextKit( animatedTexts: [ FadeAnimatedText( 'Fade In', textStyle: TextStyle(fontSize: 32, fontWeight: FontWeight.bold), ), FadeAnimatedText( 'Fade Out', textStyle: TextStyle(fontSize: 32, fontWeight: FontWeight.bold), ), ], ), // Rotate animation AnimatedTextKit( animatedTexts: [ RotateAnimatedText('AWESOME'), RotateAnimatedText('OPTIMISTIC'), RotateAnimatedText('DIFFERENT'), ], repeatForever: true, ), ], ); } ``` -------------------------------- ### Configure Flutter App Flavors in pubspec.yaml Source: https://context7.com/solido/awesome-flutter/llms.txt Define multiple app flavors (dev, prod) with distinct names, Android application IDs, and iOS bundle IDs. This configuration enables building multiple variants of the same app with different identities and configurations. Each flavor can have custom app names and package identifiers for Android and iOS platforms. ```yaml flutter_flavorizr: flavors: dev: app: name: "My App Dev" android: applicationId: "com.example.myapp.dev" ios: bundleId: "com.example.myapp.dev" prod: app: name: "My App" android: applicationId: "com.example.myapp" ios: bundleId: "com.example.myapp" ``` -------------------------------- ### Awesome Flutter Badge HTML Source: https://github.com/solido/awesome-flutter/blob/master/contributing.md This HTML snippet represents the Awesome Flutter badge that can be added to a repository. It uses an anchor tag to link to Stack Overflow's Flutter tag and an image tag for the badge itself, sourced from shields.io. ```html Awesome Flutter ``` -------------------------------- ### FlutterGen - Asset code generation with type safety Source: https://context7.com/solido/awesome-flutter/llms.txt FlutterGen generates type-safe Dart code for accessing project assets, eliminating string-based asset paths and enabling IDE autocompletion. Supports images, SVGs, and Flare animations through build_runner. Configuration in pubspec.yaml with output directory and integration options. ```dart import 'package:myapp/gen/assets.gen.dart'; // Type-safe asset access Image.asset(Assets.images.logo.path); SvgPicture.asset(Assets.icons.home.path); ``` -------------------------------- ### Flutter Secure Storage for Sensitive Data Source: https://context7.com/solido/awesome-flutter/llms.txt This snippet illustrates how to use the flutter_secure_storage package to securely store sensitive data like authentication tokens. It provides methods for writing, reading, deleting, and deleting all stored data. The 'flutter_secure_storage' package is required. ```dart // Secure Storage dependencies: flutter_secure_storage: ^latest_version import 'package:flutter_secure_storage/flutter_secure_storage.dart'; class SecureStorageService { final _storage = FlutterSecureStorage(); Future writeSecureData(String key, String value) async { await _storage.write(key: key, value: value); } Future readSecureData(String key) async { return await _storage.read(key: key); } Future deleteSecureData(String key) async { await _storage.delete(key: key); } Future deleteAll() async { await _storage.deleteAll(); } } // Usage for storing authentication tokens final secureStorage = SecureStorageService(); // Store token await secureStorage.writeSecureData('auth_token', 'your_jwt_token_here'); // Retrieve token final token = await secureStorage.readSecureData('auth_token'); // Delete token on logout await secureStorage.deleteSecureData('auth_token'); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.