npx skills add ...
npx skills add flutter/agent-plugins --skill flutter-use-http-package
npx skills add flutter/agent-plugins --skill flutter-use-http-package
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.
The same skill content is published under more than one repo. The install counts are split across them; any of these commands works.
Configure the environment and platform-specific permissions required for network access.
http package dependency via the terminal:
android/app/src/main/AndroidManifest.xml:
macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements:
Execute HTTP operations and map responses to strongly typed Dart objects.
Uri.parse('your_url').headers parameter map. Use HttpHeaders.authorizationHeader for auth tokens.jsonEncode() from dart:convert.response.statusCode. Treat 200 OK (GET/PUT/DELETE) and 201 CREATED (POST) as success.null on failure, as this prevents FutureBuilder from triggering its error state and causes infinite loading indicators.jsonDecode(response.body) and map it to a custom Dart object using a factory constructor (e.g., fromJson).Offload expensive JSON parsing to a separate Isolate to prevent UI jank (frame drops).
package:flutter/foundation.dart.compute() function to run the parsing logic in a background isolate.compute() is a top-level function or a static method, as closures or instance methods cannot be passed across isolates.Use the following checklist to implement and validate network operations.
Task Progress:
fromJson factory constructor.Future<Model>.'Content-Type': 'application/json; charset=UTF-8' and attach the jsonEncode body.200 OK).statusCode and throw an Exception on failure.Future into the UI using FutureBuilder.snapshot.hasData, snapshot.hasError, and default to a CircularProgressIndicator.