Troubleshooting - ApplETS/Notre-Dame GitHub Wiki
Résolutions aux problèmes courants rencontrés lors du développement.
Suivre la procédure de ce répertoire, accessible uniquement par les groupes admin et devops.
Symptôme :
Error: Could not find package 'notredame'.
Solution :
# Nettoyer le cache
flutter clean
# Réinstaller les dépendances
flutter pub get
# Régénérer le code
flutter pub run build_runner buildSymptôme :
Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'List<Course>'
Cause : Cast de type incorrect ou JSON mal parsé
Solution :
// ❌ MAUVAIS
List<Course> courses = jsonData; // Crash!
// ✅ BON
List<Course> courses = (jsonData as List)
.map((c) => Course.fromJson(c))
.toList();Symptôme :
setState() called after dispose():
This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree.
Cause : Callback appelé après que le widget soit détruit
Solution :
@override
void dispose() {
subscription?.cancel(); // Annuler les streams
timer?.cancel(); // Annuler les timers
super.dispose();
}
@override
void setState(VoidCallback fn) {
if (mounted) { // Vérifier que le widget est toujours là
super.setState(fn);
}
}Symptôme :
DioException: The server has not indicated when the request should be retried
Cause : Problème réseau ou URL incorrecte
Solution :
// Vérifier la connectivité
final connectivity = locator<ConnectivityService>();
if (!await connectivity.isConnected()) {
throw NetworkException('No internet connection');
}
// Vérifier l'URL
print('API URL: ${apiClient.baseUrl}');
// Ajouter un retry avec Dio
dio.interceptors.add(
RetryInterceptor(
dio: dio,
logger: Logger(),
logPrint: print,
),
);Symptôme :
DioException: Certificate verify failed
Cause : Certificat SSL invalide ou problème de configuration
Solution :
// ⚠️ SEULEMENT en développement!
Dio dio = Dio(BaseOptions(
validateStatus: (status) => status! < 500,
));
// HttpClient personnalisé
final httpClient = HttpClient();
httpClient.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;Symptôme :
A RenderFlex overflowed by 45 pixels on the bottom.
Cause : Contenu qui dépasse l'espace disponible
Solution :
// ❌ MAUVAIS
Column(
children: [
// Contenu qui dépasse
],
)
// ✅ BON: Utiliser SingleChildScrollView
SingleChildScrollView(
child: Column(
children: [
// Contenu
],
),
)
// OU Expanded pour remplir l'espace
Expanded(
child: ListView(
children: [
// Contenu
],
),
)Symptôme :
Error: Could not generate mocks for this library.
Cause : Classe non-mockable ou configuration build_runner
Solution :
# Nettoyer et regénérer
flutter pub run build_runner clean
flutter pub run build_runner build
# Ou forcer la génération
flutter pub run build_runner build -vSymptôme :
Test execution timed out after 30 seconds.
Cause : Opération asynchrone pas complétée
Symptôme :
type 'Mock' is not a subtype of type 'CourseRepository'
Cause : Mock pas généré correctement
Solution :
// ✅ Utiliser @GenerateNiceMocks
import 'package:mockito/annotations.dart';
@GenerateNiceMocks([
MockSpec<CourseRepository>(),
MockSpec<AuthService>(),
])
void main() { /* ... */ }
// Regénérer
flutter pub run build_runner buildSymptôme :
Gradle sync failed with no such file or directory
Solution :
# Nettoyer les fichiers de build
flutter clean
rm -rf android/.gradle
rm -rf build/
# Réinstaller
flutter pub get
flutter pub run build_runner build
# Ou via Android Studio
# Clic droit sur \"android\" → \"Flutter\" → \"Flutter Clean\"Symptôme :
CocoaPods error: The dependency 'X' could not be satisfied
Solution :
# Mettre à jour CocoaPods
sudo gem install cocoapods
pod repo update
# Nettoyer et réinstaller
flutter clean
rm -rf ios/Pods
rm ios/Podfile.lock
flutter pub get
cd ios && pod install && cd ..# Afficher tous les logs
flutter logs
# Filtrer par niveau
flutter logs --grep=\"E\" # Erreurs seulement
# Ou depuis adb
adb logcat | grep flutter# Ouvrir DevTools
flutter pub global run devtools
# Ou directement
flutter pub global run devtools --port 9100
# Puis ouvrir
# http://localhost:9100?uri=http://localhost:40323/XXXXXXXXXXXXXXXX/// ✅ S'assurer de libérer les ressources
@override
void dispose() {
streamSubscription?.cancel();
timer?.cancel();
controller?.dispose();
super.dispose();
}Cette page a été en partie générée avec l'aide de Claude Haiku 4.5