Technical & DevelopmentIntermediate
flutter-handling-http-and-json
Handle HTTP requests and JSON serialization
Developer Setup
Setup & Installation
bash
npx skills add https://github.com/flutter/skills --skill flutter-handling-http-and-jsonnpx skills add https://github.com/flutter/skills --skill flutter-handling-http-and-jsonOr paste this URL into your assistant to install:
Overview
What This Skill Does
Handle HTTP requests and JSON serialization
Application
When to use this Skill
- Integrating flutter handling http and json into your development workflow.
- Following best practices for handle http requests and json serialization.
- Automating repetitive tasks with AI-assisted tooling.
- Building production-grade applications with proper standards.
- Debugging and troubleshooting common implementation issues.
Documentation
Show Skills.md file
Handling HTTP and JSON
Contents
- Core Guidelines
- Workflow: Executing HTTP Operations
- Workflow: Implementing JSON Serialization
- Workflow: Parsing Large JSON in the Background
- Examples
Core Guidelines
- Enforce HTTPS: iOS and Android disable cleartext (HTTP) connections by default. Always use HTTPS endpoints. If HTTP is strictly required for debugging, configure
network_security_config.xml(Android) andNSAppTransportSecurity(iOS). - Construct URIs Safely: Always use
Uri.https(authority, unencodedPath, [queryParameters])to safely build URLs. This handles encoding and formatting reliably, preventing string concatenation errors. - Handle Status Codes: Always validate the
http.Response.statusCode. Treat200(OK) and201(Created) as success. Throw explicit exceptions for other codes (do not returnnull). - Prevent UI Jank: Move expensive JSON parsing operations (taking >16ms) to a background isolate using the
compute()function. - Structured AI Output: When integrating LLMs, enforce reliable JSON output by specifying a strict JSON schema in the system prompt and setting the response MIME type to
application/json.
Workflow: Executing HTTP Operations
Use this workflow to implement network requests using the http package.
Task Progress:
- Add the
httppackage topubspec.yaml. - Configure platform permissions (Internet permission in
AndroidManifest.xmland macOS.entitlements). - Construct the target
Uri.
Lines 1 - 25 of 173
Recommendations