feat: implement API client with JSON handling and error mapping; enhance routing and state management in app shell

This commit is contained in:
Nils-Johan Gynther
2026-04-22 07:29:21 +02:00
parent 82ba334f2d
commit e8de1d3625
12 changed files with 586 additions and 133 deletions
+25
View File
@@ -0,0 +1,25 @@
enum ApiErrorType {
unauthorized,
forbidden,
server,
network,
unknown,
}
class ApiException implements Exception {
final ApiErrorType type;
final int? statusCode;
final String message;
const ApiException({
required this.type,
required this.message,
this.statusCode,
});
@override
String toString() {
final status = statusCode == null ? '' : ' (HTTP $statusCode)';
return 'ApiException$type$status: $message';
}
}