[flutter] Dio를 사용하여 다운로드한 파일의 크기를 확인하는 방법을 알려주세요.
import 'package:dio/dio.dart';
void main() async {
// 파일의 URL
String fileUrl = 'https://www.example.com/file.zip';
try {
Response response = await Dio().head(fileUrl);
int fileSize = int.parse(response.headers.map['content-length'][0]);
print('다운로드할 파일의 크기: $fileSize 바이트');
} catch (e) {
print('파일 크기를 가져오는 중 오류 발생: $e');
}
}