← ClaudeAtlas

flutter-use-http-packagelisted

Use the `http` package to execute GET, POST, PUT, or DELETE requests. Use when you need to fetch from or send data to a REST API.
izo/Ulk · ★ 1 · Data & Documents · score 68
Install: claude install-skill izo/Ulk
# Implementing Flutter Networking ## Contents - [Configuration & Permissions](#configuration--permissions) - [Request Execution & Response Handling](#request-execution--response-handling) - [Background Parsing](#background-parsing) - [Workflow: Executing Network Operations](#workflow-executing-network-operations) - [Examples](#examples) ## Configuration & Permissions Configure the environment and platform-specific permissions required for network access. 1. Add the `http` package dependency via the terminal: ```bash flutter pub add http ``` 2. Import the package in your Dart files: ```dart import 'package:http/http.dart' as http; ``` 3. Configure Android permissions by adding the Internet permission to `android/app/src/main/AndroidManifest.xml`: ```xml <uses-permission android:name="android.permission.INTERNET" /> ``` 4. Configure macOS entitlements by adding the network client key to both `macos/Runner/DebugProfile.entitlements` and `macos/Runner/Release.entitlements`: ```xml <key>com.apple.security.network.client</key> <true/> ``` ## Request Execution & Response Handling Execute HTTP operations and map responses to strongly typed Dart objects. * **URIs:** Always parse URL strings using `Uri.parse('your_url')`. * **Headers:** Inject authorization and content-type headers via the `headers` parameter map. Use `HttpHeaders.authorizationHeader` for auth tokens. * **Payloads:** For POST and PUT requests, encode the body using `j