❓ Common Issues এবং সমাধান
FLX CLI ব্যবহার করার সময় সাধারণ সমস্যা এবং তাদের সমাধান।
🔧 Installation Issues
1. "Command not found: flx"
সমস্যা: FLX CLI install করার পরও command পাওয়া যাচ্ছে না।
সমাধান:
# Dart pub global PATH check করুন
echo $PATH
# PATH এ pub cache bin directory যোগ করুন
export PATH="$PATH":"$HOME/.pub-cache/bin"
# Linux/Mac এর জন্য bashrc/zshrc এ যোগ করুন
echo 'export PATH="$PATH":"$HOME/.pub-cache/bin"' >> ~/.bashrc
source ~/.bashrc
# Windows এর জন্য Environment Variables এ যোগ করুন
# %USERPROFILE%\AppData\Local\Pub\Cache\bin
2. "Pub get failed"
সমস্যা: Dependencies install হচ্ছে না।
সমাধান:
# Dart SDK version check করুন
dart --version
# Flutter version check করুন
flutter --version
# Cache clear করুন
dart pub cache clean
flutter clean
# আবার install করুন
dart pub global activate flx_cli
3. Permission Denied
সমস্যা: Permission error আসছে।
সমাধান:
# Linux/Mac
sudo dart pub global activate flx_cli
# অথবা user level এ install করুন
dart pub global activate flx_cli --no-executables
⚙️ Configuration Issues
1. ".flxrc.json not found"
সমস্যা: Configuration file পাওয়া যাচ্ছে না।
সমাধান:
# নতুন config file তৈরি করুন
flx config --state getx
# অথবা manual config তৈরি করুন
echo '{
"stateManagement": "getx",
"packages": {
"http": true,
"shared_preferences": true
}
}' > .flxrc.json
2. "Invalid JSON format"
সমস্যা: Config file এর JSON format ভুল।
সমাধান:
# Config reset করুন
flx config --reset
# JSON validator দিয়ে check করুন
# https://jsonlint.com/ এ config file paste করুন
# Manual fix করুন
{
"stateManagement": "getx",
"packages": {
"http": true
}
}
3. "State management not supported"
সমস্যা: Unsupported state management option।
সমাধান:
# Supported options check করুন
flx config --help
# Valid options: getx, bloc
flx config --state getx
# অথবা
flx config --state bloc
📁 Generation Issues
1. "Feature already exists"
সমস্যা: Same name এর feature আগে থেকে আছে।
সমাধান:
# Force overwrite করুন
flx gen feature auth --force
# অথবা different name ব্যবহার করুন
flx gen feature authentication
# অথবা existing feature delete করে নতুন তৈরি করুন
rm -rf lib/features/auth
flx gen feature auth
2. "Invalid feature name"
সমস্যা: Feature name invalid।
সমাধান:
# Valid naming rules:
# - No spaces
# - No special characters
# - Start with letter
# - Use camelCase বা snake_case
# ✅ Valid
flx gen feature userProfile
flx gen feature user_profile
flx gen feature auth
# ❌ Invalid
flx gen feature "user profile"
flx gen feature user-profile
flx gen feature 123user
3. "Directory not writable"
সমস্যা: Write permission নেই।
সমাধান:
# Directory permission check করুন
ls -la lib/features/
# Permission change করুন
chmod 755 lib/features/
# Sudo দিয়ে run করুন (not recommended)
sudo flx gen feature auth
🔗 Dependencies Issues
1. "Dependency version conflict"
সমস্যা: Package version conflicts।
সমাধান:
# Dependency override করুন pubspec.yaml এ
dependency_overrides:
package_name: ^1.0.0
# অথবা specific version ব্যবহার করুন
dependencies:
get: ^4.6.5
http: ^0.13.5
# Clean এবং get করুন
flutter clean
flutter pub get
2. "Package not found"
সমস্যা: Generated code এ package import করা যাচ্ছে না।
সমাধান:
# Package manually add করুন pubspec.yaml এ
dependencies:
get: ^4.6.5
http: ^0.13.5
shared_preferences: ^2.0.15
# Pub get করুন
flutter pub get
# Import check করুন
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
3. "Build runner failed"
সমস্যা: Code generation fail হচ্ছে।
সমাধান:
# Clean build cache
flutter packages pub run build_runner clean
# Force rebuild
flutter packages pub run build_runner build --delete-conflicting-outputs
# Watch mode চালু করুন
flutter packages pub run build_runner watch
🎨 Code Issues
1. "Import errors"
সমস্যা: Import statement ভুল।
সমাধান:
// ✅ Correct relative imports
import '../../domain/entities/user_entity.dart';
import '../models/user_model.dart';
// ✅ Correct absolute imports
import 'package:myapp/features/auth/domain/entities/auth_entity.dart';
// ❌ Wrong imports
import 'user_entity.dart'; // Too generic
import '/lib/features/auth/domain/entities/user_entity.dart'; // Wrong path
2. "Null safety errors"
সমস্যা: Null safety compilation errors।
সমাধান:
// ✅ Proper null safety
String? name; // Nullable
String name = ''; // Non-null with default
// Method parameters
void updateUser(String? name) {
if (name != null) {
// Use name safely
}
}
// Late initialization
late final String userId;
// Null assertion (use carefully)
String definitelyNotNull = possiblyNull!;
3. "Type mismatch errors"
সমস্যা: Data type মিলছে না।
সমাধান:
// ✅ Proper type casting
final id = json['id'] as String;
final age = json['age'] as int;
final price = (json['price'] as num).toDouble();
// ✅ Safe parsing with null check
final date = json['date'] != null
? DateTime.parse(json['date'] as String)
: null;
// ✅ List parsing
final tags = (json['tags'] as List<dynamic>)
.map((tag) => tag as String)
.toList();
🧪 Testing Issues
1. "Test files not found"
সমস্যা: Generated test files missing।
সমাধান:
# Test generation enable করুন
flx config --generate-tests true
# Manual test file তৈরি করুন
mkdir -p test/features/auth
touch test/features/auth/auth_test.dart
# Test template ব্যবহার করুন
flx gen feature auth --with-tests
2. "Mock generation failed"
সমস্যা: Mock classes তৈরি হচ্ছে না।
সমাধান:
// mockito dependency add করুন
dev_dependencies:
mockito: ^5.3.2
build_runner: ^2.3.3
// Mock annotation add করুন
import 'package:mockito/annotations.dart';
([AuthRepository, AuthUseCase])
void main() {
// Test code
}
// Generate mocks
flutter packages pub run build_runner build
3. "Widget tests failing"
সমস্যা: Widget test cases fail হচ্ছে।
সমাধান:
// ✅ Proper widget testing setup
testWidgets('should display login form', (tester) async {
// Setup
await tester.pumpWidget(
MaterialApp(
home: LoginPage(),
),
);
// Wait for widget to settle
await tester.pumpAndSettle();
// Find and verify
expect(find.byType(TextField), findsNWidgets(2));
expect(find.text('Login'), findsOneWidget);
});
🚀 Performance Issues
1. "Build time slow"
সমস্যা: Flutter build খুব slow।
সমাধান:
# Build cache clean করুন
flutter clean
# Gradle cache clean করুন (Android)
cd android && ./gradlew clean
# Incremental build enable করুন
flutter build apk --split-per-abi
# Profile mode ব্যবহার করুন development এর জন্য
flutter run --profile
2. "Hot reload not working"
সমস্যা: Hot reload কাজ করছে না।
সমাধান:
# Flutter doctor check করুন
flutter doctor
# IDE restart করুন
# VS Code: Ctrl+Shift+P -> "Reload Window"
# Android Studio: File -> Restart IDE
# Flutter restart করুন
r # Hot reload
R # Hot restart
3. "Memory issues"
সমস্যা: IDE বা build process memory crash।
সমাধান:
# IDE memory increase করুন
# VS Code: settings.json এ
"dart.maxMemory": 4096
# Android Studio: Help -> Edit Custom VM Options
-Xmx4g
# Gradle memory increase করুন
# android/gradle.properties এ
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m
🔍 Debug Tips
Debug Mode চালু করুন
# Verbose output
flx gen feature auth --verbose
# Debug information
flx config --debug
# Dry run (actual files তৈরি করে না)
flx gen feature auth --dry-run
Log Files Check করুন
# FLX CLI logs (if available)
cat ~/.flx/logs/flx.log
# Flutter logs
flutter logs
# Dart analysis
dart analyze
IDE Extensions
- VS Code: Dart, Flutter extensions
- Android Studio: Dart, Flutter plugins
- IntelliJ: Dart, Flutter plugins
📞 Help Resources
Official Documentation
Community Support
Quick Help Commands
# FLX CLI help
flx --help
flx gen --help
flx config --help
# Flutter help
flutter --help
flutter doctor
# Dart help
dart --help
dart pub --help
✅ Prevention Tips
- সবসময় latest version ব্যবহার করুন
- Configuration backup রাখুন
- Git version control ব্যবহার করুন
- Regular flutter doctor run করুন
- Dependencies regularly update করুন
- Code analysis tools ব্যবহার করুন
যদি সমস্যার সমাধান না পান: GitHub Issues এ report করুন বা community forum এ ask করুন! 🤝