APPCHOBO
SYSTEM BOOTING...
v0.1.bit · firebase build · 富士 ed.
LV14
HP87/100
MP42/80
EXP2,840
1,240 G
앱초보의 모험
◀ 프롬프트 창고
#디바이스 통합 · claude-code

파일 다운로드 및 저장 (path_provider)

네트워크에서 파일 다운로드 후 디바이스 저장.

#file-download#path-provider
변수 1 — 여기 채우면 아래 프롬프트에 바로 들어가요
네트워크에서 파일 다운로드 후 디바이스 저장. 패키지: `path_provider: ^2.1.0`, `http: ^1.1.0` 구현: ```dart class FileDownloadService { static Future<String> downloadFile({ required String fileUrl, required String fileName, }) async { final dir = await getApplicationDocumentsDirectory(); final filePath = '${dir.path}/$fileName'; final response = await http.get(Uri.parse(fileUrl)); if (response.statusCode == 200) { await File(filePath).writeAsBytes(response.bodyBytes); return filePath; } else { throw Exception('다운로드 실패'); } } static Future<void> deleteFile(String filePath) async { final file = File(filePath); if (await file.exists()) { await file.delete(); } } } ``` 사용: ```dart ElevatedButton( onPressed: () async { await FileDownloadService.downloadFile( fileUrl: 'https://example.com/file.pdf', fileName: 'document.pdf', ); }, child: Text('다운로드'), ) ``` {{FILE_TYPE}} (PDF/이미지 등) 다운로드 기능 추가할까?
쓰는 법 — 위 칸에 본인 값을 채우면 아래 프롬프트에 바로 반영돼요. 복사 버튼을 누르면 채워진 그대로 클립보드에 담기니까, claude-code(또는 본인이 쓰는 AI)에 붙여넣기만 하면 됩니다. 변수가 없으면 그냥 복사해서 쓰세요.
▼ SPONSORED ▼
프롬프트 하단 광고