Fix flutter analyze errors: correct Blob constructor usage and dispose method

This commit is contained in:
Leon Bösche
2026-01-25 01:31:33 +01:00
parent 88f1f5d87e
commit edced8825d
2 changed files with 9 additions and 3 deletions

View File

@@ -108,7 +108,10 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
final bytes = await apiClient.getBytes(path);
final mimeType =
_fileData?['capabilities']?['mimeType'] ?? 'video/mp4';
final blob = web.Blob([bytes], mimeType);
final blob = web.Blob(
[Uint8List.fromList(bytes)], // ignore: argument_type_not_assignable
web.BlobPropertyBag(type: mimeType),
);
videoUrl = web.URL.createObjectURL(blob);
} catch (e) {
// Fallback to direct URL

View File

@@ -1,5 +1,6 @@
import 'package:web/web.dart' as web;
import 'dart:async';
import 'dart:typed_data';
import '../services/api_client.dart';
import '../injection.dart';
@@ -52,7 +53,10 @@ class AudioPlayer {
final apiClient = getIt<ApiClient>();
final path = url.replaceFirst(apiClient.baseUrl, '');
final bytes = await apiClient.getBytes(path);
final blob = web.Blob([bytes], mimeType ?? 'audio/mpeg');
final blob = web.Blob(
[Uint8List.fromList(bytes)], // ignore: argument_type_not_assignable
web.BlobPropertyBag(type: mimeType ?? 'audio/mpeg'),
);
final blobUrl = web.URL.createObjectURL(blob);
_audioElement = web.HTMLAudioElement();
@@ -128,7 +132,6 @@ class AudioPlayer {
web.URL.revokeObjectURL(_blobUrl!);
_blobUrl = null;
}
}
_audioElement = null;
_positionController.close();
_durationController.close();