v2.38 — Issue #2: Dauerverbindung Cloud Server (persistenter http.Client)
- CloudService: static final http.Client _client als Instanzvariable - Alle http.get/post/put/delete/upload nutzen nun _client statt neuem Client - DownloadService: gleicher Fix für _retryHttpPost und _retryHttpGet Build: ✓ flutter analyze
This commit is contained in:
@@ -13,6 +13,8 @@ import '../config/app_config.dart';
|
||||
/// Download-Service: Lädt YouTube-Audio über den yt-proxy herunter.
|
||||
/// Nutzt ChangeNotifier für UI-Updates via ListenableBuilder.
|
||||
class DownloadService extends ChangeNotifier {
|
||||
static final http.Client _client = http.Client();
|
||||
|
||||
static final DownloadService _instanz = DownloadService._();
|
||||
factory DownloadService() => _instanz;
|
||||
DownloadService._();
|
||||
@@ -349,7 +351,7 @@ class DownloadService extends ChangeNotifier {
|
||||
Object? lastError;
|
||||
for (int versuch = 0; versuch < maxVersuche; versuch++) {
|
||||
try {
|
||||
final response = await http
|
||||
final response = await _client
|
||||
.post(url, headers: headers, body: body)
|
||||
.timeout(timeout);
|
||||
return response;
|
||||
@@ -386,7 +388,7 @@ class DownloadService extends ChangeNotifier {
|
||||
Object? lastError;
|
||||
for (int versuch = 0; versuch < maxVersuche; versuch++) {
|
||||
try {
|
||||
final response = await http
|
||||
final response = await _client
|
||||
.get(url, headers: headers)
|
||||
.timeout(timeout);
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user