# Flutter 好用package - http 介紹 ## http * GET: 檢索數據。 * POST: 保存新的數據。 * PUT: 更新數據。 * DELETE: 刪除數據。 ``` flutter pub add http ``` [官網](https://pub.dev/packages/http) ### 程式範例 ```dart const String apiUrl = '你的請求網址'; //使用get從apiUrl取得response.body final response = await get(Uri.parse(apiUrl)); if (response.statusCode == 200) { return response.body; } else { debugPrint('Request failed with status: ${response.statusCode}.'); } ``` ###### tags: `flutter`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up