### Flutter Create New Emulator Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Initiates the process of creating a new Android emulator. Requires Flutter SDK and Android SDK/emulator setup. ```bash flutter emulators --create ``` -------------------------------- ### Flutter List Emulators Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Lists all available Android emulators configured on the system. Requires Flutter SDK and Android SDK/emulator setup. ```bash flutter emulators ``` -------------------------------- ### Flutter Build Web App Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds the Flutter application for web deployment. Requires Flutter SDK and web development environment setup. ```bash flutter build web ``` -------------------------------- ### Flutter Build Windows App Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds the Flutter application for the Windows desktop platform. Requires Flutter SDK and Windows development environment setup. ```bash flutter build windows ``` -------------------------------- ### Flutter Build Linux App Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds the Flutter application for the Linux desktop platform. Requires Flutter SDK and Linux development environment setup. ```bash flutter build linux ``` -------------------------------- ### Flutter Pub Get Packages Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Fetches all the packages listed in the `pubspec.yaml` file for the current Flutter project. Requires Flutter SDK and Dart SDK. ```bash flutter pub get ``` -------------------------------- ### Flutter Pub Add Package Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Adds a specified package as a dependency to the `pubspec.yaml` file and runs `flutter pub get`. Requires Flutter SDK and Dart SDK. ```bash flutter pub add ``` -------------------------------- ### Flutter Development Tools Commands Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Tools for development tasks such as taking screenshots, symbolizing stack traces, generating localizations, creating plugin/package projects, installing apps, and building artifacts like AAR and bundles. ```bash flutter screenshot # Take a screenshot from a connected device flutter symbolize # Symbolize a stack trace flutter gen-l10n # Generate localizations flutter create --template=plugin # Create a new plugin project flutter create --template=package # Create a new package project flutter create --platforms= # Specify platform support flutter install # Install Flutter app on attached device flutter build aar # Build an AAR for integration into an Android app flutter build bundle # Build the Flutter assets directory ``` -------------------------------- ### Flutter Version Display Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Displays the currently installed Flutter SDK version. Requires Flutter SDK. ```bash flutter --version ``` -------------------------------- ### Real-Time Video/Voice Calls with ZegoCloud (Dart) Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Illustrates how to integrate ZegoCloud for real-time video and voice calls. This snippet shows initialization, user login, starting calls (video and voice), and logging out. It assumes ZegoService is initialized elsewhere and handles incoming call notifications automatically. ```dart import 'package:whatsevr_app/config/services/call/call_service.dart'; // Initialize ZegoService (done in app_initializer.dart) await ZegoService.instance.init(); // Login to call service await ZegoService.instance.login( userUid: 'user123', userName: 'John Doe', ); // Start a video call ZegoService.instance.startCall( calleeUserUid: 'user456', calleeUserName: 'Jane Smith', isVideoCall: true, ); // Start a voice call ZegoService.instance.startCall( calleeUserUid: 'user456', calleeUserName: 'Jane Smith', isVideoCall: false, ); // Logout from call service ZegoService.instance.logout(); // The app automatically handles incoming call notifications // and displays the mini overlay for active calls ``` -------------------------------- ### Push Notifications Handling (Dart) Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Provides an example of setting up and handling push notifications using a NotificationService. It covers initialization, defining a callback for notification taps to navigate to different app sections (posts, chats, user accounts), and retrieving the FCM token. ```dart import 'package:whatsevr_app/config/services/notification.dart'; // Initialize notification service (done after login) final notificationService = NotificationService(); await notificationService.initializeNotificationServices(); // Handle notification tap notificationService.onNotificationTap = (notificationData) { final type = notificationData['type']; final targetUid = notificationData['target_uid']; switch (type) { case 'post': context.push(RoutesName.wtvDetails, extra: WtvDetailsPageArgument( wtvUid: targetUid, initialIndex: 0, )); break; case 'chat': context.push(RoutesName.chatConversation, extra: ConversationPageArguments( roomId: targetUid, recipientUid: notificationData['sender_uid'], )); break; case 'follow': context.push(RoutesName.account, extra: AccountPageArgument( userUid: targetUid, isEditMode: false, )); break; } }; // Get FCM token for registration final fcmToken = await notificationService.getFcmToken(); print('FCM Token: $fcmToken'); ``` -------------------------------- ### Create and Manage Communities using Dart Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Provides Dart code examples for community management operations. This includes creating a new community with various details, fetching community details, and joining an existing community. It utilizes the `communityRepository` from the whatsevr_app API. ```dart import 'package:whatsevr_app/ApiNew/core/api_initializer.dart'; final communityRepo = DataRepositories().communityRepository; // Create a new community final createResult = await communityRepo.createCommunity( name: 'Tech Enthusiasts', description: 'A community for technology lovers', category: 'Technology', isPrivate: false, profilePictureUrl: 'https://cdn.example.com/logo.png', coverMediaUrl: 'https://cdn.example.com/cover.jpg', services: ['Events', 'Networking'], ); createResult.when( success: (response) { print('Community created: ${response.communityUid}'); }, failure: (error) { print('Error: ${error.message}'); }, ); // Get community details final detailsResult = await communityRepo.getCommunityDetails('comm789'); detailsResult.when( success: (community) { print('${community.name} - ${community.totalMembers} members'); print('Description: ${community.description}'); }, failure: (error) { print('Error: ${error.message}'); }, ); // Join a community final joinResult = await communityRepo.joinCommunity('comm789'); joinResult.when( success: (_) => print('Successfully joined community'), failure: (error) => print('Error: ${error.message}'), ); ``` -------------------------------- ### Initialize Repositories in app.dart Source: https://github.com/whatsevr/whatsevr_app/blob/main/lib/config/repositories/README.md Initializes API repositories once at the app level using ApiRepositories.initialize with the production configuration. This ensures repositories are ready before the app starts. ```dart void main() async { WidgetsFlutterBinding.ensureInitialized(); // Initialize API repositories with production config await ApiRepositories.initialize(ApiConfig.prod); runApp(const MyApp()); } ``` -------------------------------- ### Flutter Pub Add Specific Package Version Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Adds a package with a specific version constraint to the `pubspec.yaml` file and runs `flutter pub get`. Requires Flutter SDK and Dart SDK. ```bash flutter pub add : ``` -------------------------------- ### Flutter Pub Remove Package Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Removes a specified package from the `pubspec.yaml` file and runs `flutter pub get`. Requires Flutter SDK and Dart SDK. ```bash flutter pub remove ``` -------------------------------- ### Interact with Posts: Reactions and Comments (Dart) Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Provides examples for reacting to posts (liking, loving, etc.), unreacting, adding comments, and retrieving comments for a specific post. It uses the reactionsCommentsRepository for these operations. ```dart import 'package:whatsevr_app/ApiNew/core/api_initializer.dart'; final reactionsRepo = DataRepositories().reactionsCommentsRepository; // React to a post final reactResult = await reactionsRepo.reactToPost( postUid: 'wtv_456', reactionType: 'like', // like, love, wow, etc. ); reactResult.when( success: (_) => print('Reaction added'), failure: (error) => print('Error: ${error.message}'), ); // Remove reaction final unreactResult = await reactionsRepo.unreactToPost( postUid: 'wtv_456', ); unreactResult.when( success: (_) => print('Reaction removed'), failure: (error) => print('Error: ${error.message}'), ); // Add a comment final commentResult = await reactionsRepo.addComment( postUid: 'wtv_456', commentText: 'Great video!', parentCommentUid: null, // null for top-level comment ); commentResult.when( success: (commentUid) => print('Comment added: $commentUid'), failure: (error) => print('Error: ${error.message}'), ); // Get comments for a post final commentsResult = await reactionsRepo.getComments( postUid: 'wtv_456', limit: 50, offset: 0, ); commentsResult.when( success: (comments) { print('Found ${comments.length} comments'); for (var comment in comments) { print('${comment.userUid}: ${comment.text}'); } }, failure: (error) => print('Error: ${error.message}'), ); ``` -------------------------------- ### Navigate Between Screens using GoRouter in Dart Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Illustrates navigation between different screens in the Whatsevr app using the `go_router` package. Examples include navigating to user profile, post details, create post, community page, and chat conversation screens, passing necessary arguments for each destination. ```dart import 'package:go_router/go_router.dart'; import 'package:whatsevr_app/config/routes/routes_name.dart'; import 'package:whatsevr_app/src/features/account/views/page.dart'; // Navigate to user profile context.push( RoutesName.account, extra: AccountPageArgument( isEditMode: false, userUid: 'user123', ), ); // Navigate to post details context.push( RoutesName.wtvDetails, extra: WtvDetailsPageArgument( wtvUid: 'wtv_456', initialIndex: 0, ), ); // Navigate to create post context.push( RoutesName.createVideoPost, extra: CreateWtvPageArgument( initialVideoPath: '/path/to/video.mp4', communityUid: null, ), ); // Navigate to community page context.push( RoutesName.community, extra: CommunityPageArgument( communityUid: 'comm789', isEditMode: false, ), ); // Navigate to chat conversation context.push( RoutesName.chatConversation, extra: ConversationPageArguments( roomId: 'room123', recipientUid: 'user456', ), ); ``` -------------------------------- ### Fetch User Posts using Dart Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Demonstrates fetching various types of posts for a user or community using the whatsevr_app API. It covers getting video posts (WTVs), short videos (Flicks), and a mixed content feed. Error handling is included for each request. ```dart import 'package:whatsevr_app/ApiNew/core/api_initializer.dart'; final postsRepo = DataRepositories().postsRepository; // Get video posts (WTVs) for a user final wtvResult = await postsRepo.getWtvs(userUid: 'user123'); wtvResult.when( success: (response) { print('Found ${response.wtvs?.length ?? 0} videos'); for (var wtv in response.wtvs ?? []) { print('${wtv.caption} - ${wtv.videoUrl}'); } }, failure: (error) { print('Error fetching WTVs: ${error.message}'); }, ); // Get Flicks (short videos) for a community final flicksResult = await postsRepo.getFlicks(communityUid: 'comm789'); flicksResult.when( success: (response) { print('Found ${response.flicks?.length ?? 0} flicks'); }, failure: (error) { print('Error: ${error.message}'); }, ); // Get mixed content feed final mixResult = await postsRepo.getMixContent(userUid: 'user123'); mixResult.when( success: (response) { print('Mixed feed loaded with photos, videos, etc.'); }, failure: (error) { print('Error: ${error.message}'); }, ); ``` -------------------------------- ### Flutter Pub List Dependencies Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Lists all direct and transitive dependencies of the current Flutter project. Requires Flutter SDK and Dart SDK. ```bash flutter pub deps ``` -------------------------------- ### Flutter Pub Publish Package Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Publishes the current package to pub.dev. Requires Flutter SDK, Dart SDK, and authentication with pub.dev. ```bash flutter pub publish ``` -------------------------------- ### Flutter Project Management Commands Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Commands for creating new Flutter projects with specified organization names, project names, descriptions, and platform support. Also includes managing globally activated Dart packages. ```bash flutter create --org # Create project with specified org name flutter create --project-name # Set the project name flutter create --description "Description" # Add project description flutter create --platforms= # Specify supported platforms flutter pub global activate # Activate a package globally flutter pub global deactivate # Deactivate a global package flutter pub global list # List globally activated packages flutter pub global run : # Run a global package executable ``` -------------------------------- ### Initialize and Login User - Dart Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Initializes the WhatsEvr application with environment-specific configurations and logs in a user using the authentication repository. Handles success and failure scenarios, triggering authentication bloc events. Dependencies include API configuration, app initialization utilities, Firebase, and secrets management. ```dart // Initialize the app with environment-specific config import 'package:whatsevr_app/ApiNew/config/api_config.dart'; import 'package:whatsevr_app/app_initializer.dart'; import 'package:whatsevr_app/firebase_flavor_options.dart'; import 'package:whatsevr_app/secrets/secrets.dart'; Future main() async { await initializeApp( flavor: 'dev', verboseMode: true, apiConfig: ApiConfig.dev, firebaseOptions: FirebaseFlavorOptions.resolve(flavor: 'dev'), otplessAppId: 'Y0AE6HY2XGL6CF8UCEFP', supabaseUrl: 'https://dxvbdpxfzdpgiscphujy.supabase.co', supabaseAnonKey: Secrets.supabaseAnonKeyDev, ); } // Login a user through the authentication repository import 'package:whatsevr_app/ApiNew/core/api_initializer.dart'; final dataRepos = DataRepositories(); final result = await dataRepos.authRepository.login( authProviderId: 'user123', authProvider: 'otpless', mobileNumber: '+1234567890', emailId: null, fcmToken: 'fcm_token_here', ); result.when( success: (sessionUid) { print('Login successful: $sessionUid'); // Trigger auth bloc event authBloc.add(LoginRequested( userId: 'user123', loginSessionUid: sessionUid ?? '', username: 'john_doe', authEmailId: null, authMobileNumber: '+1234567890', )); }, failure: (error) { print('Login failed: ${error.message}'); }, ); ``` -------------------------------- ### Flutter Miscellaneous Commands Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Utility commands for displaying help information, suppressing warnings, controlling output color and verbosity, setting up shell completion, checking Flutter versions, and performing Dart-specific code analysis, formatting, project creation, and null safety migration. ```bash flutter help # Display help information flutter help # Display help for specific command flutter suppress warnings # Suppress Flutter tool warnings flutter --no-color # Disable color output flutter --verbose # Enable verbose logging flutter bash-completion # Output command line shell completion setup scripts flutter version # List or switch working copies of Flutter dart analyze # Analyze Dart code in the current project dart format # Format one or more Dart files dart create # Create a new Dart project dart migrate # Perform a null safety migration on a project ``` -------------------------------- ### Flutter Advanced Commands Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Advanced commands including managing custom devices, running devicelab tests, updating packages, running apps or builds with specific flavors, and defining environment variables during development or build processes. Also includes running build_runner for code generation. ```bash flutter custom-devices # List, add, or remove custom devices flutter devicelab # Commands for running devicelab tests flutter update-packages # Update packages in Flutter repo flutter run --flavor # Run app with specific flavor flutter build apk --flavor # Build APK with specific flavor flutter build ios --flavor # Build iOS app with specific flavor flutter run --dart-define== # Define environment variables flutter build --dart-define== # Define env vars for build flutter pub run build_runner build # Run build_runner for code generation flutter pub run build_runner watch # Run build_runner in watch mode ``` -------------------------------- ### Flutter Configuration Commands Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Commands to view and modify Flutter tool settings. Allows enabling/disabling platforms, and setting paths for Android SDK, Android Studio, and JDK. ```bash flutter config # Display current settings flutter config --enable- # Enable a platform (e.g., --enable-web) flutter config --no-enable- # Disable a platform flutter config --android-sdk="/path/to/sdk" # Set Android SDK path flutter config --android-studio-dir="/path/to/studio" # Set Android Studio path flutter config --jdk-dir="/path/to/jdk" # Set Java SDK path ``` -------------------------------- ### Flutter Create Project Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Creates a new Flutter project with the specified application name. Requires Flutter SDK. ```bash flutter create ``` -------------------------------- ### Flutter List Devices Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Lists all connected physical devices and available emulators that Flutter can target. Requires Flutter SDK. ```bash flutter devices ``` -------------------------------- ### Flutter Testing Commands Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Commands for running unit and integration tests in a Flutter project. Includes options for targeting specific files and generating code coverage reports. ```bash flutter test # Run unit tests flutter test # Run specific test file flutter test --coverage # Run tests with coverage flutter drive # Run integration tests flutter drive --target= # Run specific integration test ``` -------------------------------- ### Create and Manage Content Collections (Dart) Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Illustrates how to create new collections, add content to existing collections, retrieve a user's collections, and fetch the contents of a specific collection using the collectionsRepository. ```dart import 'package:whatsevr_app/ApiNew/core/api_initializer.dart'; final collectionsRepo = DataRepositories().collectionsRepository; // Create a new collection final createResult = await collectionsRepo.createCollection( name: 'Favorite Videos', description: 'My curated video collection', isPrivate: false, ); createResult.when( success: (collectionUid) => print('Collection created: $collectionUid'), failure: (error) => print('Error: ${error.message}'), ); // Add content to collection final addResult = await collectionsRepo.addContentToCollection( collectionUid: 'coll_123', contentUid: 'wtv_456', contentType: 'video', ); addResult.when( success: (_) => print('Content added to collection'), failure: (error) => print('Error: ${error.message}'), ); // Get user's collections final collectionsResult = await collectionsRepo.getUserCollections('user123'); collectionsResult.when( success: (collections) { print('Found ${collections.length} collections'); for (var collection in collections) { print('${collection.name} - ${collection.itemCount} items'); } }, failure: (error) => print('Error: ${error.message}'), ); // Get collection contents final contentsResult = await collectionsRepo.getCollectionContents( 'coll_123', limit: 20, offset: 0, ); contentsResult.when( success: (contents) { print('Collection has ${contents.length} items'); }, failure: (error) => print('Error: ${error.message}'), ); ``` -------------------------------- ### Flutter Build Android App Bundle Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds a release Android App Bundle (AAB), which is the recommended format for publishing on Google Play. Requires Flutter SDK and Android build tools. ```bash flutter build appbundle ``` -------------------------------- ### Flutter Assemble Resources Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Assembles Flutter resources, often used in conjunction with other build commands. Requires Flutter SDK. ```bash flutter assemble ``` -------------------------------- ### Flutter Build APK Split per ABI Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds multiple Android APKs, each optimized for a specific Application Binary Interface (ABI), to reduce overall app size. Requires Flutter SDK and Android build tools. ```bash flutter build apk --split-per-abi ``` -------------------------------- ### Flutter Build App Bundle (Prod) Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds a Flutter Android App Bundle in release mode for the 'prod' flavor, targeting 'lib/main_prod.dart'. Requires Flutter SDK. ```powershell pwsh> flutter build appbundle --release --flavor prod -t lib/main_prod.dart ``` -------------------------------- ### Create Video Post (WTV) - Dart Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Handles the creation of a video post (WTV) in the WhatsEvr application. Includes a sanity check before post creation to validate necessary data. Dependencies include API initializer and repository patterns. ```dart import 'package:whatsevr_app/ApiNew/core/api_initializer.dart'; final postsRepo = DataRepositories().postsRepository; // Sanity check before creating final sanityCheck = await postsRepo.api.sanityCheckWtv({ 'user_uid': 'user123', 'caption': 'My awesome video', 'video_url': 'https://cdn.example.com/video.mp4', }); // Create the video post final result = await postsRepo.api.createWtv({ 'user_uid': 'user123', 'caption': 'My awesome video', 'video_url': 'https://cdn.example.com/video.mp4', 'thumbnail_url': 'https://cdn.example.com/thumb.jpg', 'duration': 120, 'tags': ['travel', 'adventure'], 'location': 'New York, NY', 'community_uid': null, 'privacy': 'public', }); print('Video post created successfully'); ``` -------------------------------- ### Alternative: Create Repositories at Page Level Source: https://github.com/whatsevr/whatsevr_app/blob/main/lib/config/repositories/README.md Shows an alternative approach where repositories are created directly within a page widget. This offers flexibility by allowing repository instances to be scoped to specific pages if needed. ```dart class MyPage extends StatelessWidget { @override Widget build(BuildContext context) { // Use global repository instances final postsRepository = ApiRepositories.postsRepository; final communityRepository = ApiRepositories.communityRepository; return BlocProvider( create: (_) => MyBloc( postsRepository: postsRepository, communityRepository: communityRepository, ), child: MyPageContent(), ); } } ``` -------------------------------- ### Flutter Build iOS Archive and IPA Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds an archive of the Flutter iOS app and generates an IPA file, suitable for distribution or App Store submission. Requires Flutter SDK, Xcode, and macOS. ```bash flutter build ipa ``` -------------------------------- ### Flutter Build macOS App Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds the Flutter application for the macOS desktop platform. Requires Flutter SDK, Xcode, and macOS. ```bash flutter build macos ``` -------------------------------- ### Flutter Pub Upgrade Packages Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Upgrades all packages in the project to their latest compatible versions based on the constraints in `pubspec.yaml`. Requires Flutter SDK and Dart SDK. ```bash flutter pub upgrade ``` -------------------------------- ### Flutter Build iOS App Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds the Flutter application for the iOS platform. Requires Flutter SDK, Xcode, and macOS. ```bash flutter build ios ``` -------------------------------- ### Flutter Pub Run Executable Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Runs an executable script provided by a package in the project. Useful for code generation or custom build tasks. Requires Flutter SDK and Dart SDK. ```bash flutter pub run ``` -------------------------------- ### Flutter Maintenance Commands Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Commands for cleaning build artifacts, analyzing code for errors and suggestions, formatting code, managing Flutter channels, downgrading versions, and precaching binary artifacts. ```bash flutter clean # Delete build directory flutter analyze # Analyze code for errors flutter analyze --suggestions # Show suggestions along with errors flutter format # Format code according to Dart style flutter format --set-exit-if-changed # Exit with code 1 if files changed flutter format # Format specific file or directory flutter channel # List Flutter channels flutter channel # Switch to another channel (stable/beta/dev/master) flutter downgrade # Downgrade Flutter to the last active version flutter precache # Populate Flutter tool's cache of binary artifacts ``` -------------------------------- ### Flutter Show Logs Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Displays logs from currently running Flutter applications. Requires a running Flutter app. ```bash flutter logs ``` -------------------------------- ### Flutter Upgrade Command Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Updates the Flutter SDK to the latest available version. Requires Flutter SDK and internet connection. ```bash flutter upgrade ``` -------------------------------- ### Flutter Build Android APK Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds a release Android APK file for the Flutter application. Requires Flutter SDK and Android build tools. ```bash flutter build apk ``` -------------------------------- ### Migration: Repository Usage in BLoC (Before and After DI) Source: https://github.com/whatsevr/whatsevr_app/blob/main/lib/config/repositories/README.md Compares the structure of a BLoC before and after removing GetIt dependency injection. It highlights that the way repositories are used within the BLoC remains the same, demonstrating the simplicity of the refactor. ```dart // Before (with GetIt): class MyBloc extends Bloc { final PostsRepository postsRepository; MyBloc({required this.postsRepository}) : super(const MyState()); // Use postsRepository directly } // After (without DI): class MyBloc extends Bloc { final PostsRepository postsRepository; MyBloc({required this.postsRepository}) : super(const MyState()); // Use postsRepository directly (same as before!) } ``` -------------------------------- ### Dart Build Runner Execution Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Executes the Dart build runner to generate code, with an option to delete conflicting output files. Requires Dart SDK and the build_runner package. ```powershell pwsh> dart run build_runner build --delete-conflicting-outputs ``` -------------------------------- ### Flutter Build and Firebase Distribution (Prod) Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds a Flutter Android APK in release mode for the 'prod' flavor and distributes it via Firebase App Distribution to the 'testers' group. Requires Firebase CLI and Flutter SDK. ```powershell pwsh> flutter build apk --release --flavor prod --target-platform android-arm64 -t lib/main_prod.dart && \ firebase appdistribution:distribute build/app/outputs/flutter-apk/app-prod-release.apk --app 1:728320078708:android:e4aed323f18ceed3a63221 --groups "testers" ``` -------------------------------- ### Flutter Run in Release Mode Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Runs the Flutter application in release mode for performance testing. Requires Flutter SDK. ```bash flutter run --release ``` -------------------------------- ### Manage User Profiles and Search Users/Communities (Dart) Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Demonstrates fetching user supportive data, following a user, and searching for users and communities. It utilizes repositories for user and search operations. Errors are handled by printing error messages. ```dart import 'package:whatsevr_app/ApiNew/core/api_initializer.dart'; final usersRepo = DataRepositories().usersRepository; final searchRepo = DataRepositories().searchRepository; // Get user supportive data (followers, following, etc.) final userDataResult = await usersRepo.getSupportiveUserData('user123'); userDataResult.when( success: (data) { print('User: ${data.userInfo?.username}'); print('Followers: ${data.userInfo?.totalFollowers}'); print('Following: ${data.userInfo?.totalFollowing}'); }, failure: (error) => print('Error: ${error.message}'), ); // Follow a user final followResult = await usersRepo.followUser('user456'); followResult.when( success: (_) => print('Successfully followed user'), failure: (error) => print('Error: ${error.message}'), ); // Search for users final searchResult = await searchRepo.searchUsers( query: 'john', limit: 20, offset: 0, ); searchResult.when( success: (results) { print('Found ${results.users?.length ?? 0} users'); for (var user in results.users ?? []) { print('${user.username} - ${user.profilePicture}'); } }, failure: (error) => print('Error: ${error.message}'), ); // Search for communities final communitySearchResult = await searchRepo.searchCommunities( query: 'tech', limit: 20, ); communitySearchResult.when( success: (results) { print('Found ${results.communities?.length ?? 0} communities'); }, failure: (error) => print('Error: ${error.message}'), ); ``` -------------------------------- ### Upload Media to CDN (Dart) Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Demonstrates uploading various media types (video, image, PDF) to a CDN using the FileUploadService. It includes progress callbacks and error handling. Dependencies include 'dart:io' and a custom 'file_upload.dart' service. ```dart import 'package:whatsevr_app/config/services/cdn/file_upload.dart'; import 'dart:io'; // Initialize the upload service (done in app_initializer.dart) FileUploadService.init(); // Upload a video file final videoFile = File('/path/to/video.mp4'); final uploadResult = await FileUploadService.uploadVideo( file: videoFile, onProgress: (progress) { print('Upload progress: ${(progress * 100).toStringAsFixed(1)}%'); }, ); if (uploadResult.success) { print('Video uploaded: ${uploadResult.url}'); print('Thumbnail: ${uploadResult.thumbnailUrl}'); } else { print('Upload failed: ${uploadResult.error}'); } // Upload an image final imageFile = File('/path/to/photo.jpg'); final imageResult = await FileUploadService.uploadImage( file: imageFile, compress: true, maxWidth: 1920, maxHeight: 1080, quality: 85, onProgress: (progress) { print('Upload progress: ${(progress * 100).toStringAsFixed(1)}%'); }, ); if (imageResult.success) { print('Image uploaded: ${imageResult.url}'); } else { print('Upload failed: ${imageResult.error}'); } // Upload PDF document final pdfFile = File('/path/to/document.pdf'); final pdfResult = await FileUploadService.uploadPdf( file: pdfFile, onProgress: (progress) { print('Upload progress: ${(progress * 100).toStringAsFixed(1)}%'); }, ); if (pdfResult.success) { print('PDF uploaded: ${pdfResult.url}'); } else { print('Upload failed: ${pdfResult.error}'); } ``` -------------------------------- ### Flutter Launch Specific Emulator Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Launches a specific Android emulator identified by its ID. Requires Flutter SDK and configured emulators. ```bash flutter emulators --launch ``` -------------------------------- ### Flutter Run with Flavor and Verbose Logging Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Runs a Flutter application in debug mode using the 'dev' flavor and target from 'lib/main_dev.dart', with verbose logging enabled. Requires Flutter SDK. ```powershell pwsh> flutter run --flavor dev -t lib/main_dev.dart --verbose ``` -------------------------------- ### Flutter Build and Firebase Distribution (Dev) Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Builds a Flutter Android APK in release mode for the 'dev' flavor and distributes it via Firebase App Distribution to the 'All' group. Requires Firebase CLI and Flutter SDK. ```powershell pwsh> flutter build apk --release --flavor dev --target-platform android-arm64 -t lib/main_dev.dart && \ firebase appdistribution:distribute build/app/outputs/flutter-apk/app-dev-release.apk --app 1:728320078708:android:f9adb57d2ffe1376a63221 --groups "All" ``` -------------------------------- ### Firebase App Distribution Group Listing Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Lists the available Firebase App Distribution groups for a specified project. Requires Firebase CLI. ```powershell pwsh> firebase appdistribution:groups:list --project whatsevr-live ``` -------------------------------- ### Flutter Pub Check Outdated Packages Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Checks for packages in the project that have newer versions available on pub.dev, based on `pubspec.yaml` constraints. Requires Flutter SDK and Dart SDK. ```bash flutter pub outdated ``` -------------------------------- ### Flutter Run in Profile Mode Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Runs the Flutter application in profile mode, which is useful for performance analysis and debugging. Requires Flutter SDK. ```bash flutter run --profile ``` -------------------------------- ### Access Global Repository Instances Source: https://github.com/whatsevr/whatsevr_app/blob/main/lib/config/repositories/README.md Provides direct access to globally created repository instances within the ApiRepositories class. This allows easy retrieval of specific repositories like posts, community, and auth. ```dart import 'package:whatsevr_app/ApiNew/core/api_initializer.dart'; // Access global repository instances final postsRepository = ApiRepositories.postsRepository; final communityRepository = ApiRepositories.communityRepository; final authRepository = ApiRepositories.authRepository; ``` -------------------------------- ### Flutter Doctor Command Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Checks Flutter dependencies and identifies potential issues within the development environment. Requires Flutter SDK. ```bash flutter doctor ``` -------------------------------- ### Flutter Pub Upgrade Major Versions Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Upgrades packages in the project, including those with breaking changes (major version updates), respecting semantic versioning. Requires Flutter SDK and Dart SDK. ```bash flutter pub upgrade --major-versions ``` -------------------------------- ### Manage Multi-User Accounts - Dart (Flutter BLoC) Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Demonstrates how to manage multiple user accounts within the WhatsEvr application using Flutter's BLoC pattern. Includes switching between local user accounts and listening to authentication state changes. Dependencies include flutter_bloc. ```dart import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:whatsevr_app/config/global_bloc/auth_bloc/auth_bloc.dart'; // Switch to a different locally stored user account final authBloc = context.read(); // Get list of local authenticated users final localUsers = authBloc.state.localAuthUsers; for (var user in localUsers) { print('${user.userName} (${user.userUid})'); } // Switch to specific user authBloc.add(SwitchFromLocalAuthUserRequested(userId: 'user456')); // Listen to auth state changes BlocBuilder( builder: (context, state) { if (state.status == AuthStatus.authenticated) { return Text('Welcome ${state.activeUser?.userName}!'); } else if (state.status == AuthStatus.loading) { return CircularProgressIndicator(); } else { return Text('Please log in'); } }, ); ``` -------------------------------- ### Inject BLoCs with Repositories at Router Level Source: https://github.com/whatsevr/whatsevr_app/blob/main/lib/config/repositories/README.md Demonstrates injecting BLoCs with global repositories directly within the router configuration. This method creates BLoCs with their required repositories when routes are defined, promoting explicit dependencies. ```dart // In your router file (e.g., lib/config/routes/router.dart) class AppRouter { static GoRouter get router { return GoRouter( routes: [ GoRoute( path: '/home', builder: (context, state) { // Create BLoC with global repositories final homeBloc = HomeBloc( postsRepository: ApiRepositories.postsRepository, communityRepository: ApiRepositories.communityRepository, ); return BlocProvider( create: (_) => homeBloc, child: HomePage(), ); }, ), GoRoute( path: '/community/:id', builder: (context, state) { final communityId = state.pathParameters['id']!; // Create BLoC with global repository final communityBloc = CommunityBloc( communityUid: communityId, communityRepository: ApiRepositories.communityRepository, ); return BlocProvider( create: (_) => communityBloc, child: CommunityPage(), ); }, ), ], ); } } ``` -------------------------------- ### BLoC State Management with Flutter (Dart) Source: https://context7.com/whatsevr/whatsevr_app/llms.txt Shows how to implement feature-specific BLoCs for state management in a Flutter application using the 'flutter_bloc' package. It covers creating a BlocProvider, using BlocConsumer for listening to state changes and building UI, and dispatching events to update the state. ```dart import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:whatsevr_app/src/features/home/bloc/home_bloc.dart'; import 'package:flutter/material.dart'; // Create and use a feature BLoC class HomePageExample extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( create: (context) => HomeBloc()..add(LoadHomeFeed()), child: BlocConsumer( listener: (context, state) { if (state.error != null) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text(state.error!)), ); } }, builder: (context, state) { if (state.isLoading) { return Center(child: CircularProgressIndicator()); } if (state.posts.isEmpty) { return Center(child: Text('No posts available')); } return ListView.builder( itemCount: state.posts.length, itemBuilder: (context, index) { final post = state.posts[index]; return ListTile( title: Text(post.caption ?? ''), subtitle: Text(post.userName ?? ''), ); }, ); }, ), ); } } // Dispatch events to update state context.read().add(RefreshHomeFeed()); context.read().add(LoadMorePosts()); ``` -------------------------------- ### Handle ApiResult with .when() Source: https://github.com/whatsevr/whatsevr_app/blob/main/lib/config/repositories/README.md Illustrates the recommended way to handle the `ApiResult` type returned by repository methods. The `.when()` method provides distinct callbacks for success and failure scenarios, ensuring proper error handling. ```dart final result = await someRepository.someMethod(); result.when( success: (data) { // Handle successful response // data is of type T }, failure: (error) { // Handle error // error is of type AppException }, ); ``` -------------------------------- ### Flutter Run with Hot Reload Enabled Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Runs the Flutter application with hot reload enabled, allowing for quick UI updates without restarting the app. This is typically the default behavior. ```bash flutter run --hot ``` -------------------------------- ### Flutter Run on Specific Device Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Runs the Flutter application on a specific connected device, identified by its device ID. Requires Flutter SDK and connected devices. ```bash flutter run -d ``` -------------------------------- ### Flutter Attach to Running App Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Attaches the Flutter debugger to a currently running Flutter application instance. Requires a running app. ```bash flutter attach ``` -------------------------------- ### Flutter Run in Debug Mode Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Runs the Flutter application in debug mode, enabling hot reload by default. Requires Flutter SDK. ```bash flutter run ``` -------------------------------- ### Flutter Run without Hot Reload Source: https://github.com/whatsevr/whatsevr_app/blob/main/README.md Runs the Flutter application without hot reload enabled. This forces a full restart of the application for changes to take effect. ```bash flutter run --no-hot ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.