Fix flutter analyze errors: correct Blob constructor usage and dispose method
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user