[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-flutter-flutter-use-http-package":3,"mdc--bd1n5o-key":34,"related-repo-flutter-flutter-use-http-package":1563,"related-org-flutter-flutter-use-http-package":1643},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":24,"repoUrl":25,"updatedAt":26,"license":27,"forks":28,"topics":29,"repo":30,"sourceUrl":32,"mdContent":33},"flutter-use-http-package","execute HTTP requests in Flutter","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.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"flutter","Flutter (Google)","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fflutter.png",[12,15,18,21],{"name":13,"slug":8,"type":14},"Flutter","tag",{"name":16,"slug":17,"type":14},"HTTP","http",{"name":19,"slug":20,"type":14},"REST API","rest-api",{"name":22,"slug":23,"type":14},"Dart","dart",2664,"https:\u002F\u002Fgithub.com\u002Fflutter\u002Fagent-plugins","2026-07-15T05:22:37.641771",null,155,[],{"repoUrl":25,"stars":24,"forks":28,"topics":31,"description":27},[],"https:\u002F\u002Fgithub.com\u002Fflutter\u002Fagent-plugins\u002Ftree\u002FHEAD\u002Fskills\u002Fflutter-use-http-package","---\nname: flutter-use-http-package\ndescription: 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.\nmetadata:\n  model: models\u002Fgemini-3.1-pro-preview\n  last_modified: Tue, 21 Apr 2026 21:36:42 GMT\n---\n# Implementing Flutter Networking\n\n## Contents\n- [Configuration & Permissions](#configuration--permissions)\n- [Request Execution & Response Handling](#request-execution--response-handling)\n- [Background Parsing](#background-parsing)\n- [Workflow: Executing Network Operations](#workflow-executing-network-operations)\n- [Examples](#examples)\n\n## Configuration & Permissions\n\nConfigure the environment and platform-specific permissions required for network access.\n\n1. Add the `http` package dependency via the terminal:\n   ```bash\n   flutter pub add http\n   ```\n2. Import the package in your Dart files:\n   ```dart\n   import 'package:http\u002Fhttp.dart' as http;\n   ```\n3. Configure Android permissions by adding the Internet permission to `android\u002Fapp\u002Fsrc\u002Fmain\u002FAndroidManifest.xml`:\n   ```xml\n   \u003Cuses-permission android:name=\"android.permission.INTERNET\" \u002F>\n   ```\n4. Configure macOS entitlements by adding the network client key to both `macos\u002FRunner\u002FDebugProfile.entitlements` and `macos\u002FRunner\u002FRelease.entitlements`:\n   ```xml\n   \u003Ckey>com.apple.security.network.client\u003C\u002Fkey>\n   \u003Ctrue\u002F>\n   ```\n\n## Request Execution & Response Handling\n\nExecute HTTP operations and map responses to strongly typed Dart objects.\n\n*   **URIs:** Always parse URL strings using `Uri.parse('your_url')`.\n*   **Headers:** Inject authorization and content-type headers via the `headers` parameter map. Use `HttpHeaders.authorizationHeader` for auth tokens.\n*   **Payloads:** For POST and PUT requests, encode the body using `jsonEncode()` from `dart:convert`.\n*   **Status Validation:** Evaluate `response.statusCode`. Treat `200 OK` (GET\u002FPUT\u002FDELETE) and `201 CREATED` (POST) as success. \n*   **Error Handling:** Throw explicit exceptions for non-success status codes. Never return `null` on failure, as this prevents `FutureBuilder` from triggering its error state and causes infinite loading indicators.\n*   **Deserialization:** Parse the raw string using `jsonDecode(response.body)` and map it to a custom Dart object using a factory constructor (e.g., `fromJson`).\n\n## Background Parsing\n\nOffload expensive JSON parsing to a separate Isolate to prevent UI jank (frame drops).\n\n*   Import `package:flutter\u002Ffoundation.dart`.\n*   Use the `compute()` function to run the parsing logic in a background isolate.\n*   Ensure the parsing function passed to `compute()` is a top-level function or a static method, as closures or instance methods cannot be passed across isolates.\n\n## Workflow: Executing Network Operations\n\nUse the following checklist to implement and validate network operations.\n\n**Task Progress:**\n- [ ] 1. Define the strongly typed Dart model with a `fromJson` factory constructor.\n- [ ] 2. Implement the network request method returning a `Future\u003CModel>`.\n- [ ] 3. Apply conditional logic based on the operation type:\n  - **If fetching data (GET):** Append query parameters to the URI.\n  - **If mutating data (POST\u002FPUT):** Set `'Content-Type': 'application\u002Fjson; charset=UTF-8'` and attach the `jsonEncode` body.\n  - **If deleting data (DELETE):** Return an empty model instance on success (`200 OK`).\n- [ ] 4. Validate the `statusCode` and throw an `Exception` on failure.\n- [ ] 5. Integrate the `Future` into the UI using `FutureBuilder`.\n- [ ] 6. Handle `snapshot.hasData`, `snapshot.hasError`, and default to a `CircularProgressIndicator`.\n- [ ] 7. **Feedback Loop:** Run the app -> trigger the network request -> review console for unhandled exceptions -> fix parsing or permission errors.\n\n## Examples\n\n### High-Fidelity Implementation: Fetching and Parsing in the Background\n\n```dart\nimport 'dart:async';\nimport 'dart:convert';\nimport 'dart:io';\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter\u002Fmaterial.dart';\nimport 'package:http\u002Fhttp.dart' as http;\n\n\u002F\u002F 1. Top-level parsing function for Isolate\nList\u003CPhoto> parsePhotos(String responseBody) {\n  final parsed = (jsonDecode(responseBody) as List\u003CObject?>)\n      .cast\u003CMap\u003CString, Object?>>();\n  return parsed.map\u003CPhoto>(Photo.fromJson).toList();\n}\n\n\u002F\u002F 2. Network execution with background parsing\nFuture\u003CList\u003CPhoto>> fetchPhotos() async {\n  final response = await http.get(\n    Uri.parse('https:\u002F\u002Fjsonplaceholder.typicode.com\u002Fphotos'),\n    headers: {\n      HttpHeaders.authorizationHeader: 'Bearer your_token_here',\n      HttpHeaders.acceptHeader: 'application\u002Fjson',\n    },\n  );\n\n  if (response.statusCode == 200) {\n    \u002F\u002F Offload heavy parsing to a background isolate\n    return compute(parsePhotos, response.body);\n  } else {\n    throw Exception('Failed to load photos. Status: ${response.statusCode}');\n  }\n}\n\n\u002F\u002F 3. Strongly typed model\nclass Photo {\n  final int id;\n  final String title;\n  final String thumbnailUrl;\n\n  const Photo({\n    required this.id,\n    required this.title,\n    required this.thumbnailUrl,\n  });\n\n  factory Photo.fromJson(Map\u003CString, dynamic> json) {\n    return Photo(\n      id: json['id'] as int,\n      title: json['title'] as String,\n      thumbnailUrl: json['thumbnailUrl'] as String,\n    );\n  }\n}\n\n\u002F\u002F 4. UI Integration\nclass PhotoGallery extends StatefulWidget {\n  const PhotoGallery({super.key});\n\n  @override\n  State\u003CPhotoGallery> createState() => _PhotoGalleryState();\n}\n\nclass _PhotoGalleryState extends State\u003CPhotoGallery> {\n  late Future\u003CList\u003CPhoto>> _futurePhotos;\n\n  @override\n  void initState() {\n    super.initState();\n    \u002F\u002F Initialize Future once to prevent re-fetching on rebuilds\n    _futurePhotos = fetchPhotos();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return FutureBuilder\u003CList\u003CPhoto>>(\n      future: _futurePhotos,\n      builder: (context, snapshot) {\n        if (snapshot.hasData) {\n          final photos = snapshot.data!;\n          return ListView.builder(\n            itemCount: photos.length,\n            itemBuilder: (context, index) => ListTile(\n              leading: Image.network(photos[index].thumbnailUrl),\n              title: Text(photos[index].title),\n            ),\n          );\n        } else if (snapshot.hasError) {\n          return Center(child: Text('Error: ${snapshot.error}'));\n        }\n        \n        \u002F\u002F Default loading state\n        return const Center(child: CircularProgressIndicator());\n      },\n    );\n  }\n}\n```\n",{"data":35,"body":39},{"name":4,"description":6,"metadata":36},{"model":37,"last_modified":38},"models\u002Fgemini-3.1-pro-preview","Tue, 21 Apr 2026 21:36:42 GMT",{"type":40,"children":41},"root",[42,51,58,109,114,120,268,273,278,437,442,447,487,492,497,505,706,711,718,1557],{"type":43,"tag":44,"props":45,"children":47},"element","h1",{"id":46},"implementing-flutter-networking",[48],{"type":49,"value":50},"text","Implementing Flutter Networking",{"type":43,"tag":52,"props":53,"children":55},"h2",{"id":54},"contents",[56],{"type":49,"value":57},"Contents",{"type":43,"tag":59,"props":60,"children":61},"ul",{},[62,73,82,91,100],{"type":43,"tag":63,"props":64,"children":65},"li",{},[66],{"type":43,"tag":67,"props":68,"children":70},"a",{"href":69},"#configuration--permissions",[71],{"type":49,"value":72},"Configuration & Permissions",{"type":43,"tag":63,"props":74,"children":75},{},[76],{"type":43,"tag":67,"props":77,"children":79},{"href":78},"#request-execution--response-handling",[80],{"type":49,"value":81},"Request Execution & Response Handling",{"type":43,"tag":63,"props":83,"children":84},{},[85],{"type":43,"tag":67,"props":86,"children":88},{"href":87},"#background-parsing",[89],{"type":49,"value":90},"Background Parsing",{"type":43,"tag":63,"props":92,"children":93},{},[94],{"type":43,"tag":67,"props":95,"children":97},{"href":96},"#workflow-executing-network-operations",[98],{"type":49,"value":99},"Workflow: Executing Network Operations",{"type":43,"tag":63,"props":101,"children":102},{},[103],{"type":43,"tag":67,"props":104,"children":106},{"href":105},"#examples",[107],{"type":49,"value":108},"Examples",{"type":43,"tag":52,"props":110,"children":112},{"id":111},"configuration-permissions",[113],{"type":49,"value":72},{"type":43,"tag":115,"props":116,"children":117},"p",{},[118],{"type":49,"value":119},"Configure the environment and platform-specific permissions required for network access.",{"type":43,"tag":121,"props":122,"children":123},"ol",{},[124,175,195,224],{"type":43,"tag":63,"props":125,"children":126},{},[127,129,135,137],{"type":49,"value":128},"Add the ",{"type":43,"tag":130,"props":131,"children":133},"code",{"className":132},[],[134],{"type":49,"value":17},{"type":49,"value":136}," package dependency via the terminal:\n",{"type":43,"tag":138,"props":139,"children":144},"pre",{"className":140,"code":141,"language":142,"meta":143,"style":143},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","flutter pub add http\n","bash","",[145],{"type":43,"tag":130,"props":146,"children":147},{"__ignoreMap":143},[148],{"type":43,"tag":149,"props":150,"children":153},"span",{"class":151,"line":152},"line",1,[154,159,165,170],{"type":43,"tag":149,"props":155,"children":157},{"style":156},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[158],{"type":49,"value":8},{"type":43,"tag":149,"props":160,"children":162},{"style":161},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[163],{"type":49,"value":164}," pub",{"type":43,"tag":149,"props":166,"children":167},{"style":161},[168],{"type":49,"value":169}," add",{"type":43,"tag":149,"props":171,"children":172},{"style":161},[173],{"type":49,"value":174}," http\n",{"type":43,"tag":63,"props":176,"children":177},{},[178,180],{"type":49,"value":179},"Import the package in your Dart files:\n",{"type":43,"tag":138,"props":181,"children":184},{"className":182,"code":183,"language":23,"meta":143,"style":143},"language-dart shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import 'package:http\u002Fhttp.dart' as http;\n",[185],{"type":43,"tag":130,"props":186,"children":187},{"__ignoreMap":143},[188],{"type":43,"tag":149,"props":189,"children":190},{"class":151,"line":152},[191],{"type":43,"tag":149,"props":192,"children":193},{},[194],{"type":49,"value":183},{"type":43,"tag":63,"props":196,"children":197},{},[198,200,206,208],{"type":49,"value":199},"Configure Android permissions by adding the Internet permission to ",{"type":43,"tag":130,"props":201,"children":203},{"className":202},[],[204],{"type":49,"value":205},"android\u002Fapp\u002Fsrc\u002Fmain\u002FAndroidManifest.xml",{"type":49,"value":207},":\n",{"type":43,"tag":138,"props":209,"children":213},{"className":210,"code":211,"language":212,"meta":143,"style":143},"language-xml shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u003Cuses-permission android:name=\"android.permission.INTERNET\" \u002F>\n","xml",[214],{"type":43,"tag":130,"props":215,"children":216},{"__ignoreMap":143},[217],{"type":43,"tag":149,"props":218,"children":219},{"class":151,"line":152},[220],{"type":43,"tag":149,"props":221,"children":222},{},[223],{"type":49,"value":211},{"type":43,"tag":63,"props":225,"children":226},{},[227,229,235,237,243,244],{"type":49,"value":228},"Configure macOS entitlements by adding the network client key to both ",{"type":43,"tag":130,"props":230,"children":232},{"className":231},[],[233],{"type":49,"value":234},"macos\u002FRunner\u002FDebugProfile.entitlements",{"type":49,"value":236}," and ",{"type":43,"tag":130,"props":238,"children":240},{"className":239},[],[241],{"type":49,"value":242},"macos\u002FRunner\u002FRelease.entitlements",{"type":49,"value":207},{"type":43,"tag":138,"props":245,"children":247},{"className":210,"code":246,"language":212,"meta":143,"style":143},"\u003Ckey>com.apple.security.network.client\u003C\u002Fkey>\n\u003Ctrue\u002F>\n",[248],{"type":43,"tag":130,"props":249,"children":250},{"__ignoreMap":143},[251,259],{"type":43,"tag":149,"props":252,"children":253},{"class":151,"line":152},[254],{"type":43,"tag":149,"props":255,"children":256},{},[257],{"type":49,"value":258},"\u003Ckey>com.apple.security.network.client\u003C\u002Fkey>\n",{"type":43,"tag":149,"props":260,"children":262},{"class":151,"line":261},2,[263],{"type":43,"tag":149,"props":264,"children":265},{},[266],{"type":49,"value":267},"\u003Ctrue\u002F>\n",{"type":43,"tag":52,"props":269,"children":271},{"id":270},"request-execution-response-handling",[272],{"type":49,"value":81},{"type":43,"tag":115,"props":274,"children":275},{},[276],{"type":49,"value":277},"Execute HTTP operations and map responses to strongly typed Dart objects.",{"type":43,"tag":59,"props":279,"children":280},{},[281,300,326,351,385,411],{"type":43,"tag":63,"props":282,"children":283},{},[284,290,292,298],{"type":43,"tag":285,"props":286,"children":287},"strong",{},[288],{"type":49,"value":289},"URIs:",{"type":49,"value":291}," Always parse URL strings using ",{"type":43,"tag":130,"props":293,"children":295},{"className":294},[],[296],{"type":49,"value":297},"Uri.parse('your_url')",{"type":49,"value":299},".",{"type":43,"tag":63,"props":301,"children":302},{},[303,308,310,316,318,324],{"type":43,"tag":285,"props":304,"children":305},{},[306],{"type":49,"value":307},"Headers:",{"type":49,"value":309}," Inject authorization and content-type headers via the ",{"type":43,"tag":130,"props":311,"children":313},{"className":312},[],[314],{"type":49,"value":315},"headers",{"type":49,"value":317}," parameter map. Use ",{"type":43,"tag":130,"props":319,"children":321},{"className":320},[],[322],{"type":49,"value":323},"HttpHeaders.authorizationHeader",{"type":49,"value":325}," for auth tokens.",{"type":43,"tag":63,"props":327,"children":328},{},[329,334,336,342,344,350],{"type":43,"tag":285,"props":330,"children":331},{},[332],{"type":49,"value":333},"Payloads:",{"type":49,"value":335}," For POST and PUT requests, encode the body using ",{"type":43,"tag":130,"props":337,"children":339},{"className":338},[],[340],{"type":49,"value":341},"jsonEncode()",{"type":49,"value":343}," from ",{"type":43,"tag":130,"props":345,"children":347},{"className":346},[],[348],{"type":49,"value":349},"dart:convert",{"type":49,"value":299},{"type":43,"tag":63,"props":352,"children":353},{},[354,359,361,367,369,375,377,383],{"type":43,"tag":285,"props":355,"children":356},{},[357],{"type":49,"value":358},"Status Validation:",{"type":49,"value":360}," Evaluate ",{"type":43,"tag":130,"props":362,"children":364},{"className":363},[],[365],{"type":49,"value":366},"response.statusCode",{"type":49,"value":368},". Treat ",{"type":43,"tag":130,"props":370,"children":372},{"className":371},[],[373],{"type":49,"value":374},"200 OK",{"type":49,"value":376}," (GET\u002FPUT\u002FDELETE) and ",{"type":43,"tag":130,"props":378,"children":380},{"className":379},[],[381],{"type":49,"value":382},"201 CREATED",{"type":49,"value":384}," (POST) as success.",{"type":43,"tag":63,"props":386,"children":387},{},[388,393,395,401,403,409],{"type":43,"tag":285,"props":389,"children":390},{},[391],{"type":49,"value":392},"Error Handling:",{"type":49,"value":394}," Throw explicit exceptions for non-success status codes. Never return ",{"type":43,"tag":130,"props":396,"children":398},{"className":397},[],[399],{"type":49,"value":400},"null",{"type":49,"value":402}," on failure, as this prevents ",{"type":43,"tag":130,"props":404,"children":406},{"className":405},[],[407],{"type":49,"value":408},"FutureBuilder",{"type":49,"value":410}," from triggering its error state and causes infinite loading indicators.",{"type":43,"tag":63,"props":412,"children":413},{},[414,419,421,427,429,435],{"type":43,"tag":285,"props":415,"children":416},{},[417],{"type":49,"value":418},"Deserialization:",{"type":49,"value":420}," Parse the raw string using ",{"type":43,"tag":130,"props":422,"children":424},{"className":423},[],[425],{"type":49,"value":426},"jsonDecode(response.body)",{"type":49,"value":428}," and map it to a custom Dart object using a factory constructor (e.g., ",{"type":43,"tag":130,"props":430,"children":432},{"className":431},[],[433],{"type":49,"value":434},"fromJson",{"type":49,"value":436},").",{"type":43,"tag":52,"props":438,"children":440},{"id":439},"background-parsing",[441],{"type":49,"value":90},{"type":43,"tag":115,"props":443,"children":444},{},[445],{"type":49,"value":446},"Offload expensive JSON parsing to a separate Isolate to prevent UI jank (frame drops).",{"type":43,"tag":59,"props":448,"children":449},{},[450,462,475],{"type":43,"tag":63,"props":451,"children":452},{},[453,455,461],{"type":49,"value":454},"Import ",{"type":43,"tag":130,"props":456,"children":458},{"className":457},[],[459],{"type":49,"value":460},"package:flutter\u002Ffoundation.dart",{"type":49,"value":299},{"type":43,"tag":63,"props":463,"children":464},{},[465,467,473],{"type":49,"value":466},"Use the ",{"type":43,"tag":130,"props":468,"children":470},{"className":469},[],[471],{"type":49,"value":472},"compute()",{"type":49,"value":474}," function to run the parsing logic in a background isolate.",{"type":43,"tag":63,"props":476,"children":477},{},[478,480,485],{"type":49,"value":479},"Ensure the parsing function passed to ",{"type":43,"tag":130,"props":481,"children":483},{"className":482},[],[484],{"type":49,"value":472},{"type":49,"value":486}," is a top-level function or a static method, as closures or instance methods cannot be passed across isolates.",{"type":43,"tag":52,"props":488,"children":490},{"id":489},"workflow-executing-network-operations",[491],{"type":49,"value":99},{"type":43,"tag":115,"props":493,"children":494},{},[495],{"type":49,"value":496},"Use the following checklist to implement and validate network operations.",{"type":43,"tag":115,"props":498,"children":499},{},[500],{"type":43,"tag":285,"props":501,"children":502},{},[503],{"type":49,"value":504},"Task Progress:",{"type":43,"tag":59,"props":506,"children":509},{"className":507},[508],"contains-task-list",[510,530,546,610,635,658,690],{"type":43,"tag":63,"props":511,"children":514},{"className":512},[513],"task-list-item",[515,521,523,528],{"type":43,"tag":516,"props":517,"children":520},"input",{"disabled":518,"type":519},true,"checkbox",[],{"type":49,"value":522}," 1. Define the strongly typed Dart model with a ",{"type":43,"tag":130,"props":524,"children":526},{"className":525},[],[527],{"type":49,"value":434},{"type":49,"value":529}," factory constructor.",{"type":43,"tag":63,"props":531,"children":533},{"className":532},[513],[534,537,539,545],{"type":43,"tag":516,"props":535,"children":536},{"disabled":518,"type":519},[],{"type":49,"value":538}," 2. Implement the network request method returning a ",{"type":43,"tag":130,"props":540,"children":542},{"className":541},[],[543],{"type":49,"value":544},"Future\u003CModel>",{"type":49,"value":299},{"type":43,"tag":63,"props":547,"children":549},{"className":548},[513],[550,553,555],{"type":43,"tag":516,"props":551,"children":552},{"disabled":518,"type":519},[],{"type":49,"value":554}," 3. Apply conditional logic based on the operation type:\n",{"type":43,"tag":59,"props":556,"children":557},{},[558,568,594],{"type":43,"tag":63,"props":559,"children":560},{},[561,566],{"type":43,"tag":285,"props":562,"children":563},{},[564],{"type":49,"value":565},"If fetching data (GET):",{"type":49,"value":567}," Append query parameters to the URI.",{"type":43,"tag":63,"props":569,"children":570},{},[571,576,578,584,586,592],{"type":43,"tag":285,"props":572,"children":573},{},[574],{"type":49,"value":575},"If mutating data (POST\u002FPUT):",{"type":49,"value":577}," Set ",{"type":43,"tag":130,"props":579,"children":581},{"className":580},[],[582],{"type":49,"value":583},"'Content-Type': 'application\u002Fjson; charset=UTF-8'",{"type":49,"value":585}," and attach the ",{"type":43,"tag":130,"props":587,"children":589},{"className":588},[],[590],{"type":49,"value":591},"jsonEncode",{"type":49,"value":593}," body.",{"type":43,"tag":63,"props":595,"children":596},{},[597,602,604,609],{"type":43,"tag":285,"props":598,"children":599},{},[600],{"type":49,"value":601},"If deleting data (DELETE):",{"type":49,"value":603}," Return an empty model instance on success (",{"type":43,"tag":130,"props":605,"children":607},{"className":606},[],[608],{"type":49,"value":374},{"type":49,"value":436},{"type":43,"tag":63,"props":611,"children":613},{"className":612},[513],[614,617,619,625,627,633],{"type":43,"tag":516,"props":615,"children":616},{"disabled":518,"type":519},[],{"type":49,"value":618}," 4. Validate the ",{"type":43,"tag":130,"props":620,"children":622},{"className":621},[],[623],{"type":49,"value":624},"statusCode",{"type":49,"value":626}," and throw an ",{"type":43,"tag":130,"props":628,"children":630},{"className":629},[],[631],{"type":49,"value":632},"Exception",{"type":49,"value":634}," on failure.",{"type":43,"tag":63,"props":636,"children":638},{"className":637},[513],[639,642,644,650,652,657],{"type":43,"tag":516,"props":640,"children":641},{"disabled":518,"type":519},[],{"type":49,"value":643}," 5. Integrate the ",{"type":43,"tag":130,"props":645,"children":647},{"className":646},[],[648],{"type":49,"value":649},"Future",{"type":49,"value":651}," into the UI using ",{"type":43,"tag":130,"props":653,"children":655},{"className":654},[],[656],{"type":49,"value":408},{"type":49,"value":299},{"type":43,"tag":63,"props":659,"children":661},{"className":660},[513],[662,665,667,673,675,681,683,689],{"type":43,"tag":516,"props":663,"children":664},{"disabled":518,"type":519},[],{"type":49,"value":666}," 6. Handle ",{"type":43,"tag":130,"props":668,"children":670},{"className":669},[],[671],{"type":49,"value":672},"snapshot.hasData",{"type":49,"value":674},", ",{"type":43,"tag":130,"props":676,"children":678},{"className":677},[],[679],{"type":49,"value":680},"snapshot.hasError",{"type":49,"value":682},", and default to a ",{"type":43,"tag":130,"props":684,"children":686},{"className":685},[],[687],{"type":49,"value":688},"CircularProgressIndicator",{"type":49,"value":299},{"type":43,"tag":63,"props":691,"children":693},{"className":692},[513],[694,697,699,704],{"type":43,"tag":516,"props":695,"children":696},{"disabled":518,"type":519},[],{"type":49,"value":698}," 7. ",{"type":43,"tag":285,"props":700,"children":701},{},[702],{"type":49,"value":703},"Feedback Loop:",{"type":49,"value":705}," Run the app -> trigger the network request -> review console for unhandled exceptions -> fix parsing or permission errors.",{"type":43,"tag":52,"props":707,"children":709},{"id":708},"examples",[710],{"type":49,"value":108},{"type":43,"tag":712,"props":713,"children":715},"h3",{"id":714},"high-fidelity-implementation-fetching-and-parsing-in-the-background",[716],{"type":49,"value":717},"High-Fidelity Implementation: Fetching and Parsing in the Background",{"type":43,"tag":138,"props":719,"children":721},{"className":182,"code":720,"language":23,"meta":143,"style":143},"import 'dart:async';\nimport 'dart:convert';\nimport 'dart:io';\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter\u002Fmaterial.dart';\nimport 'package:http\u002Fhttp.dart' as http;\n\n\u002F\u002F 1. Top-level parsing function for Isolate\nList\u003CPhoto> parsePhotos(String responseBody) {\n  final parsed = (jsonDecode(responseBody) as List\u003CObject?>)\n      .cast\u003CMap\u003CString, Object?>>();\n  return parsed.map\u003CPhoto>(Photo.fromJson).toList();\n}\n\n\u002F\u002F 2. Network execution with background parsing\nFuture\u003CList\u003CPhoto>> fetchPhotos() async {\n  final response = await http.get(\n    Uri.parse('https:\u002F\u002Fjsonplaceholder.typicode.com\u002Fphotos'),\n    headers: {\n      HttpHeaders.authorizationHeader: 'Bearer your_token_here',\n      HttpHeaders.acceptHeader: 'application\u002Fjson',\n    },\n  );\n\n  if (response.statusCode == 200) {\n    \u002F\u002F Offload heavy parsing to a background isolate\n    return compute(parsePhotos, response.body);\n  } else {\n    throw Exception('Failed to load photos. Status: ${response.statusCode}');\n  }\n}\n\n\u002F\u002F 3. Strongly typed model\nclass Photo {\n  final int id;\n  final String title;\n  final String thumbnailUrl;\n\n  const Photo({\n    required this.id,\n    required this.title,\n    required this.thumbnailUrl,\n  });\n\n  factory Photo.fromJson(Map\u003CString, dynamic> json) {\n    return Photo(\n      id: json['id'] as int,\n      title: json['title'] as String,\n      thumbnailUrl: json['thumbnailUrl'] as String,\n    );\n  }\n}\n\n\u002F\u002F 4. UI Integration\nclass PhotoGallery extends StatefulWidget {\n  const PhotoGallery({super.key});\n\n  @override\n  State\u003CPhotoGallery> createState() => _PhotoGalleryState();\n}\n\nclass _PhotoGalleryState extends State\u003CPhotoGallery> {\n  late Future\u003CList\u003CPhoto>> _futurePhotos;\n\n  @override\n  void initState() {\n    super.initState();\n    \u002F\u002F Initialize Future once to prevent re-fetching on rebuilds\n    _futurePhotos = fetchPhotos();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return FutureBuilder\u003CList\u003CPhoto>>(\n      future: _futurePhotos,\n      builder: (context, snapshot) {\n        if (snapshot.hasData) {\n          final photos = snapshot.data!;\n          return ListView.builder(\n            itemCount: photos.length,\n            itemBuilder: (context, index) => ListTile(\n              leading: Image.network(photos[index].thumbnailUrl),\n              title: Text(photos[index].title),\n            ),\n          );\n        } else if (snapshot.hasError) {\n          return Center(child: Text('Error: ${snapshot.error}'));\n        }\n        \n        \u002F\u002F Default loading state\n        return const Center(child: CircularProgressIndicator());\n      },\n    );\n  }\n}\n",[722],{"type":43,"tag":130,"props":723,"children":724},{"__ignoreMap":143},[725,733,741,750,759,768,776,785,794,803,812,821,830,839,847,856,865,874,883,892,901,910,919,928,936,945,954,963,972,981,990,998,1006,1015,1024,1033,1042,1051,1059,1068,1077,1086,1095,1104,1112,1121,1130,1139,1148,1157,1166,1174,1182,1190,1199,1208,1217,1225,1234,1243,1251,1259,1268,1277,1285,1293,1302,1311,1320,1329,1337,1345,1353,1362,1371,1380,1389,1398,1407,1416,1425,1434,1443,1452,1461,1470,1479,1488,1497,1506,1515,1524,1533,1541,1549],{"type":43,"tag":149,"props":726,"children":727},{"class":151,"line":152},[728],{"type":43,"tag":149,"props":729,"children":730},{},[731],{"type":49,"value":732},"import 'dart:async';\n",{"type":43,"tag":149,"props":734,"children":735},{"class":151,"line":261},[736],{"type":43,"tag":149,"props":737,"children":738},{},[739],{"type":49,"value":740},"import 'dart:convert';\n",{"type":43,"tag":149,"props":742,"children":744},{"class":151,"line":743},3,[745],{"type":43,"tag":149,"props":746,"children":747},{},[748],{"type":49,"value":749},"import 'dart:io';\n",{"type":43,"tag":149,"props":751,"children":753},{"class":151,"line":752},4,[754],{"type":43,"tag":149,"props":755,"children":756},{},[757],{"type":49,"value":758},"import 'package:flutter\u002Ffoundation.dart';\n",{"type":43,"tag":149,"props":760,"children":762},{"class":151,"line":761},5,[763],{"type":43,"tag":149,"props":764,"children":765},{},[766],{"type":49,"value":767},"import 'package:flutter\u002Fmaterial.dart';\n",{"type":43,"tag":149,"props":769,"children":771},{"class":151,"line":770},6,[772],{"type":43,"tag":149,"props":773,"children":774},{},[775],{"type":49,"value":183},{"type":43,"tag":149,"props":777,"children":779},{"class":151,"line":778},7,[780],{"type":43,"tag":149,"props":781,"children":782},{"emptyLinePlaceholder":518},[783],{"type":49,"value":784},"\n",{"type":43,"tag":149,"props":786,"children":788},{"class":151,"line":787},8,[789],{"type":43,"tag":149,"props":790,"children":791},{},[792],{"type":49,"value":793},"\u002F\u002F 1. Top-level parsing function for Isolate\n",{"type":43,"tag":149,"props":795,"children":797},{"class":151,"line":796},9,[798],{"type":43,"tag":149,"props":799,"children":800},{},[801],{"type":49,"value":802},"List\u003CPhoto> parsePhotos(String responseBody) {\n",{"type":43,"tag":149,"props":804,"children":806},{"class":151,"line":805},10,[807],{"type":43,"tag":149,"props":808,"children":809},{},[810],{"type":49,"value":811},"  final parsed = (jsonDecode(responseBody) as List\u003CObject?>)\n",{"type":43,"tag":149,"props":813,"children":815},{"class":151,"line":814},11,[816],{"type":43,"tag":149,"props":817,"children":818},{},[819],{"type":49,"value":820},"      .cast\u003CMap\u003CString, Object?>>();\n",{"type":43,"tag":149,"props":822,"children":824},{"class":151,"line":823},12,[825],{"type":43,"tag":149,"props":826,"children":827},{},[828],{"type":49,"value":829},"  return parsed.map\u003CPhoto>(Photo.fromJson).toList();\n",{"type":43,"tag":149,"props":831,"children":833},{"class":151,"line":832},13,[834],{"type":43,"tag":149,"props":835,"children":836},{},[837],{"type":49,"value":838},"}\n",{"type":43,"tag":149,"props":840,"children":842},{"class":151,"line":841},14,[843],{"type":43,"tag":149,"props":844,"children":845},{"emptyLinePlaceholder":518},[846],{"type":49,"value":784},{"type":43,"tag":149,"props":848,"children":850},{"class":151,"line":849},15,[851],{"type":43,"tag":149,"props":852,"children":853},{},[854],{"type":49,"value":855},"\u002F\u002F 2. Network execution with background parsing\n",{"type":43,"tag":149,"props":857,"children":859},{"class":151,"line":858},16,[860],{"type":43,"tag":149,"props":861,"children":862},{},[863],{"type":49,"value":864},"Future\u003CList\u003CPhoto>> fetchPhotos() async {\n",{"type":43,"tag":149,"props":866,"children":868},{"class":151,"line":867},17,[869],{"type":43,"tag":149,"props":870,"children":871},{},[872],{"type":49,"value":873},"  final response = await http.get(\n",{"type":43,"tag":149,"props":875,"children":877},{"class":151,"line":876},18,[878],{"type":43,"tag":149,"props":879,"children":880},{},[881],{"type":49,"value":882},"    Uri.parse('https:\u002F\u002Fjsonplaceholder.typicode.com\u002Fphotos'),\n",{"type":43,"tag":149,"props":884,"children":886},{"class":151,"line":885},19,[887],{"type":43,"tag":149,"props":888,"children":889},{},[890],{"type":49,"value":891},"    headers: {\n",{"type":43,"tag":149,"props":893,"children":895},{"class":151,"line":894},20,[896],{"type":43,"tag":149,"props":897,"children":898},{},[899],{"type":49,"value":900},"      HttpHeaders.authorizationHeader: 'Bearer your_token_here',\n",{"type":43,"tag":149,"props":902,"children":904},{"class":151,"line":903},21,[905],{"type":43,"tag":149,"props":906,"children":907},{},[908],{"type":49,"value":909},"      HttpHeaders.acceptHeader: 'application\u002Fjson',\n",{"type":43,"tag":149,"props":911,"children":913},{"class":151,"line":912},22,[914],{"type":43,"tag":149,"props":915,"children":916},{},[917],{"type":49,"value":918},"    },\n",{"type":43,"tag":149,"props":920,"children":922},{"class":151,"line":921},23,[923],{"type":43,"tag":149,"props":924,"children":925},{},[926],{"type":49,"value":927},"  );\n",{"type":43,"tag":149,"props":929,"children":931},{"class":151,"line":930},24,[932],{"type":43,"tag":149,"props":933,"children":934},{"emptyLinePlaceholder":518},[935],{"type":49,"value":784},{"type":43,"tag":149,"props":937,"children":939},{"class":151,"line":938},25,[940],{"type":43,"tag":149,"props":941,"children":942},{},[943],{"type":49,"value":944},"  if (response.statusCode == 200) {\n",{"type":43,"tag":149,"props":946,"children":948},{"class":151,"line":947},26,[949],{"type":43,"tag":149,"props":950,"children":951},{},[952],{"type":49,"value":953},"    \u002F\u002F Offload heavy parsing to a background isolate\n",{"type":43,"tag":149,"props":955,"children":957},{"class":151,"line":956},27,[958],{"type":43,"tag":149,"props":959,"children":960},{},[961],{"type":49,"value":962},"    return compute(parsePhotos, response.body);\n",{"type":43,"tag":149,"props":964,"children":966},{"class":151,"line":965},28,[967],{"type":43,"tag":149,"props":968,"children":969},{},[970],{"type":49,"value":971},"  } else {\n",{"type":43,"tag":149,"props":973,"children":975},{"class":151,"line":974},29,[976],{"type":43,"tag":149,"props":977,"children":978},{},[979],{"type":49,"value":980},"    throw Exception('Failed to load photos. Status: ${response.statusCode}');\n",{"type":43,"tag":149,"props":982,"children":984},{"class":151,"line":983},30,[985],{"type":43,"tag":149,"props":986,"children":987},{},[988],{"type":49,"value":989},"  }\n",{"type":43,"tag":149,"props":991,"children":993},{"class":151,"line":992},31,[994],{"type":43,"tag":149,"props":995,"children":996},{},[997],{"type":49,"value":838},{"type":43,"tag":149,"props":999,"children":1001},{"class":151,"line":1000},32,[1002],{"type":43,"tag":149,"props":1003,"children":1004},{"emptyLinePlaceholder":518},[1005],{"type":49,"value":784},{"type":43,"tag":149,"props":1007,"children":1009},{"class":151,"line":1008},33,[1010],{"type":43,"tag":149,"props":1011,"children":1012},{},[1013],{"type":49,"value":1014},"\u002F\u002F 3. Strongly typed model\n",{"type":43,"tag":149,"props":1016,"children":1018},{"class":151,"line":1017},34,[1019],{"type":43,"tag":149,"props":1020,"children":1021},{},[1022],{"type":49,"value":1023},"class Photo {\n",{"type":43,"tag":149,"props":1025,"children":1027},{"class":151,"line":1026},35,[1028],{"type":43,"tag":149,"props":1029,"children":1030},{},[1031],{"type":49,"value":1032},"  final int id;\n",{"type":43,"tag":149,"props":1034,"children":1036},{"class":151,"line":1035},36,[1037],{"type":43,"tag":149,"props":1038,"children":1039},{},[1040],{"type":49,"value":1041},"  final String title;\n",{"type":43,"tag":149,"props":1043,"children":1045},{"class":151,"line":1044},37,[1046],{"type":43,"tag":149,"props":1047,"children":1048},{},[1049],{"type":49,"value":1050},"  final String thumbnailUrl;\n",{"type":43,"tag":149,"props":1052,"children":1054},{"class":151,"line":1053},38,[1055],{"type":43,"tag":149,"props":1056,"children":1057},{"emptyLinePlaceholder":518},[1058],{"type":49,"value":784},{"type":43,"tag":149,"props":1060,"children":1062},{"class":151,"line":1061},39,[1063],{"type":43,"tag":149,"props":1064,"children":1065},{},[1066],{"type":49,"value":1067},"  const Photo({\n",{"type":43,"tag":149,"props":1069,"children":1071},{"class":151,"line":1070},40,[1072],{"type":43,"tag":149,"props":1073,"children":1074},{},[1075],{"type":49,"value":1076},"    required this.id,\n",{"type":43,"tag":149,"props":1078,"children":1080},{"class":151,"line":1079},41,[1081],{"type":43,"tag":149,"props":1082,"children":1083},{},[1084],{"type":49,"value":1085},"    required this.title,\n",{"type":43,"tag":149,"props":1087,"children":1089},{"class":151,"line":1088},42,[1090],{"type":43,"tag":149,"props":1091,"children":1092},{},[1093],{"type":49,"value":1094},"    required this.thumbnailUrl,\n",{"type":43,"tag":149,"props":1096,"children":1098},{"class":151,"line":1097},43,[1099],{"type":43,"tag":149,"props":1100,"children":1101},{},[1102],{"type":49,"value":1103},"  });\n",{"type":43,"tag":149,"props":1105,"children":1107},{"class":151,"line":1106},44,[1108],{"type":43,"tag":149,"props":1109,"children":1110},{"emptyLinePlaceholder":518},[1111],{"type":49,"value":784},{"type":43,"tag":149,"props":1113,"children":1115},{"class":151,"line":1114},45,[1116],{"type":43,"tag":149,"props":1117,"children":1118},{},[1119],{"type":49,"value":1120},"  factory Photo.fromJson(Map\u003CString, dynamic> json) {\n",{"type":43,"tag":149,"props":1122,"children":1124},{"class":151,"line":1123},46,[1125],{"type":43,"tag":149,"props":1126,"children":1127},{},[1128],{"type":49,"value":1129},"    return Photo(\n",{"type":43,"tag":149,"props":1131,"children":1133},{"class":151,"line":1132},47,[1134],{"type":43,"tag":149,"props":1135,"children":1136},{},[1137],{"type":49,"value":1138},"      id: json['id'] as int,\n",{"type":43,"tag":149,"props":1140,"children":1142},{"class":151,"line":1141},48,[1143],{"type":43,"tag":149,"props":1144,"children":1145},{},[1146],{"type":49,"value":1147},"      title: json['title'] as String,\n",{"type":43,"tag":149,"props":1149,"children":1151},{"class":151,"line":1150},49,[1152],{"type":43,"tag":149,"props":1153,"children":1154},{},[1155],{"type":49,"value":1156},"      thumbnailUrl: json['thumbnailUrl'] as String,\n",{"type":43,"tag":149,"props":1158,"children":1160},{"class":151,"line":1159},50,[1161],{"type":43,"tag":149,"props":1162,"children":1163},{},[1164],{"type":49,"value":1165},"    );\n",{"type":43,"tag":149,"props":1167,"children":1169},{"class":151,"line":1168},51,[1170],{"type":43,"tag":149,"props":1171,"children":1172},{},[1173],{"type":49,"value":989},{"type":43,"tag":149,"props":1175,"children":1177},{"class":151,"line":1176},52,[1178],{"type":43,"tag":149,"props":1179,"children":1180},{},[1181],{"type":49,"value":838},{"type":43,"tag":149,"props":1183,"children":1185},{"class":151,"line":1184},53,[1186],{"type":43,"tag":149,"props":1187,"children":1188},{"emptyLinePlaceholder":518},[1189],{"type":49,"value":784},{"type":43,"tag":149,"props":1191,"children":1193},{"class":151,"line":1192},54,[1194],{"type":43,"tag":149,"props":1195,"children":1196},{},[1197],{"type":49,"value":1198},"\u002F\u002F 4. UI Integration\n",{"type":43,"tag":149,"props":1200,"children":1202},{"class":151,"line":1201},55,[1203],{"type":43,"tag":149,"props":1204,"children":1205},{},[1206],{"type":49,"value":1207},"class PhotoGallery extends StatefulWidget {\n",{"type":43,"tag":149,"props":1209,"children":1211},{"class":151,"line":1210},56,[1212],{"type":43,"tag":149,"props":1213,"children":1214},{},[1215],{"type":49,"value":1216},"  const PhotoGallery({super.key});\n",{"type":43,"tag":149,"props":1218,"children":1220},{"class":151,"line":1219},57,[1221],{"type":43,"tag":149,"props":1222,"children":1223},{"emptyLinePlaceholder":518},[1224],{"type":49,"value":784},{"type":43,"tag":149,"props":1226,"children":1228},{"class":151,"line":1227},58,[1229],{"type":43,"tag":149,"props":1230,"children":1231},{},[1232],{"type":49,"value":1233},"  @override\n",{"type":43,"tag":149,"props":1235,"children":1237},{"class":151,"line":1236},59,[1238],{"type":43,"tag":149,"props":1239,"children":1240},{},[1241],{"type":49,"value":1242},"  State\u003CPhotoGallery> createState() => _PhotoGalleryState();\n",{"type":43,"tag":149,"props":1244,"children":1246},{"class":151,"line":1245},60,[1247],{"type":43,"tag":149,"props":1248,"children":1249},{},[1250],{"type":49,"value":838},{"type":43,"tag":149,"props":1252,"children":1254},{"class":151,"line":1253},61,[1255],{"type":43,"tag":149,"props":1256,"children":1257},{"emptyLinePlaceholder":518},[1258],{"type":49,"value":784},{"type":43,"tag":149,"props":1260,"children":1262},{"class":151,"line":1261},62,[1263],{"type":43,"tag":149,"props":1264,"children":1265},{},[1266],{"type":49,"value":1267},"class _PhotoGalleryState extends State\u003CPhotoGallery> {\n",{"type":43,"tag":149,"props":1269,"children":1271},{"class":151,"line":1270},63,[1272],{"type":43,"tag":149,"props":1273,"children":1274},{},[1275],{"type":49,"value":1276},"  late Future\u003CList\u003CPhoto>> _futurePhotos;\n",{"type":43,"tag":149,"props":1278,"children":1280},{"class":151,"line":1279},64,[1281],{"type":43,"tag":149,"props":1282,"children":1283},{"emptyLinePlaceholder":518},[1284],{"type":49,"value":784},{"type":43,"tag":149,"props":1286,"children":1288},{"class":151,"line":1287},65,[1289],{"type":43,"tag":149,"props":1290,"children":1291},{},[1292],{"type":49,"value":1233},{"type":43,"tag":149,"props":1294,"children":1296},{"class":151,"line":1295},66,[1297],{"type":43,"tag":149,"props":1298,"children":1299},{},[1300],{"type":49,"value":1301},"  void initState() {\n",{"type":43,"tag":149,"props":1303,"children":1305},{"class":151,"line":1304},67,[1306],{"type":43,"tag":149,"props":1307,"children":1308},{},[1309],{"type":49,"value":1310},"    super.initState();\n",{"type":43,"tag":149,"props":1312,"children":1314},{"class":151,"line":1313},68,[1315],{"type":43,"tag":149,"props":1316,"children":1317},{},[1318],{"type":49,"value":1319},"    \u002F\u002F Initialize Future once to prevent re-fetching on rebuilds\n",{"type":43,"tag":149,"props":1321,"children":1323},{"class":151,"line":1322},69,[1324],{"type":43,"tag":149,"props":1325,"children":1326},{},[1327],{"type":49,"value":1328},"    _futurePhotos = fetchPhotos();\n",{"type":43,"tag":149,"props":1330,"children":1332},{"class":151,"line":1331},70,[1333],{"type":43,"tag":149,"props":1334,"children":1335},{},[1336],{"type":49,"value":989},{"type":43,"tag":149,"props":1338,"children":1340},{"class":151,"line":1339},71,[1341],{"type":43,"tag":149,"props":1342,"children":1343},{"emptyLinePlaceholder":518},[1344],{"type":49,"value":784},{"type":43,"tag":149,"props":1346,"children":1348},{"class":151,"line":1347},72,[1349],{"type":43,"tag":149,"props":1350,"children":1351},{},[1352],{"type":49,"value":1233},{"type":43,"tag":149,"props":1354,"children":1356},{"class":151,"line":1355},73,[1357],{"type":43,"tag":149,"props":1358,"children":1359},{},[1360],{"type":49,"value":1361},"  Widget build(BuildContext context) {\n",{"type":43,"tag":149,"props":1363,"children":1365},{"class":151,"line":1364},74,[1366],{"type":43,"tag":149,"props":1367,"children":1368},{},[1369],{"type":49,"value":1370},"    return FutureBuilder\u003CList\u003CPhoto>>(\n",{"type":43,"tag":149,"props":1372,"children":1374},{"class":151,"line":1373},75,[1375],{"type":43,"tag":149,"props":1376,"children":1377},{},[1378],{"type":49,"value":1379},"      future: _futurePhotos,\n",{"type":43,"tag":149,"props":1381,"children":1383},{"class":151,"line":1382},76,[1384],{"type":43,"tag":149,"props":1385,"children":1386},{},[1387],{"type":49,"value":1388},"      builder: (context, snapshot) {\n",{"type":43,"tag":149,"props":1390,"children":1392},{"class":151,"line":1391},77,[1393],{"type":43,"tag":149,"props":1394,"children":1395},{},[1396],{"type":49,"value":1397},"        if (snapshot.hasData) {\n",{"type":43,"tag":149,"props":1399,"children":1401},{"class":151,"line":1400},78,[1402],{"type":43,"tag":149,"props":1403,"children":1404},{},[1405],{"type":49,"value":1406},"          final photos = snapshot.data!;\n",{"type":43,"tag":149,"props":1408,"children":1410},{"class":151,"line":1409},79,[1411],{"type":43,"tag":149,"props":1412,"children":1413},{},[1414],{"type":49,"value":1415},"          return ListView.builder(\n",{"type":43,"tag":149,"props":1417,"children":1419},{"class":151,"line":1418},80,[1420],{"type":43,"tag":149,"props":1421,"children":1422},{},[1423],{"type":49,"value":1424},"            itemCount: photos.length,\n",{"type":43,"tag":149,"props":1426,"children":1428},{"class":151,"line":1427},81,[1429],{"type":43,"tag":149,"props":1430,"children":1431},{},[1432],{"type":49,"value":1433},"            itemBuilder: (context, index) => ListTile(\n",{"type":43,"tag":149,"props":1435,"children":1437},{"class":151,"line":1436},82,[1438],{"type":43,"tag":149,"props":1439,"children":1440},{},[1441],{"type":49,"value":1442},"              leading: Image.network(photos[index].thumbnailUrl),\n",{"type":43,"tag":149,"props":1444,"children":1446},{"class":151,"line":1445},83,[1447],{"type":43,"tag":149,"props":1448,"children":1449},{},[1450],{"type":49,"value":1451},"              title: Text(photos[index].title),\n",{"type":43,"tag":149,"props":1453,"children":1455},{"class":151,"line":1454},84,[1456],{"type":43,"tag":149,"props":1457,"children":1458},{},[1459],{"type":49,"value":1460},"            ),\n",{"type":43,"tag":149,"props":1462,"children":1464},{"class":151,"line":1463},85,[1465],{"type":43,"tag":149,"props":1466,"children":1467},{},[1468],{"type":49,"value":1469},"          );\n",{"type":43,"tag":149,"props":1471,"children":1473},{"class":151,"line":1472},86,[1474],{"type":43,"tag":149,"props":1475,"children":1476},{},[1477],{"type":49,"value":1478},"        } else if (snapshot.hasError) {\n",{"type":43,"tag":149,"props":1480,"children":1482},{"class":151,"line":1481},87,[1483],{"type":43,"tag":149,"props":1484,"children":1485},{},[1486],{"type":49,"value":1487},"          return Center(child: Text('Error: ${snapshot.error}'));\n",{"type":43,"tag":149,"props":1489,"children":1491},{"class":151,"line":1490},88,[1492],{"type":43,"tag":149,"props":1493,"children":1494},{},[1495],{"type":49,"value":1496},"        }\n",{"type":43,"tag":149,"props":1498,"children":1500},{"class":151,"line":1499},89,[1501],{"type":43,"tag":149,"props":1502,"children":1503},{},[1504],{"type":49,"value":1505},"        \n",{"type":43,"tag":149,"props":1507,"children":1509},{"class":151,"line":1508},90,[1510],{"type":43,"tag":149,"props":1511,"children":1512},{},[1513],{"type":49,"value":1514},"        \u002F\u002F Default loading state\n",{"type":43,"tag":149,"props":1516,"children":1518},{"class":151,"line":1517},91,[1519],{"type":43,"tag":149,"props":1520,"children":1521},{},[1522],{"type":49,"value":1523},"        return const Center(child: CircularProgressIndicator());\n",{"type":43,"tag":149,"props":1525,"children":1527},{"class":151,"line":1526},92,[1528],{"type":43,"tag":149,"props":1529,"children":1530},{},[1531],{"type":49,"value":1532},"      },\n",{"type":43,"tag":149,"props":1534,"children":1536},{"class":151,"line":1535},93,[1537],{"type":43,"tag":149,"props":1538,"children":1539},{},[1540],{"type":49,"value":1165},{"type":43,"tag":149,"props":1542,"children":1544},{"class":151,"line":1543},94,[1545],{"type":43,"tag":149,"props":1546,"children":1547},{},[1548],{"type":49,"value":989},{"type":43,"tag":149,"props":1550,"children":1552},{"class":151,"line":1551},95,[1553],{"type":43,"tag":149,"props":1554,"children":1555},{},[1556],{"type":49,"value":838},{"type":43,"tag":1558,"props":1559,"children":1560},"style",{},[1561],{"type":49,"value":1562},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":1564,"total":930},[1565,1576,1587,1599,1610,1619,1631],{"slug":1566,"name":1566,"fn":1567,"description":1568,"org":1569,"tags":1570,"stars":24,"repoUrl":25,"updatedAt":1575},"dart-add-unit-test","write unit tests for Dart code","Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1571,1572],{"name":22,"slug":23,"type":14},{"name":1573,"slug":1574,"type":14},"Testing","testing","2026-07-15T05:22:40.104823",{"slug":1577,"name":1577,"fn":1578,"description":1579,"org":1580,"tags":1581,"stars":24,"repoUrl":25,"updatedAt":1586},"dart-build-cli-app","build Dart command line applications","Entrypoint structure, exit codes, cross-platform scripts. Use when building command line utilities, scripts, or applications.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1582,1585],{"name":1583,"slug":1584,"type":14},"CLI","cli",{"name":22,"slug":23,"type":14},"2026-07-15T05:22:18.863572",{"slug":1588,"name":1588,"fn":1589,"description":1590,"org":1591,"tags":1592,"stars":24,"repoUrl":25,"updatedAt":1598},"dart-collect-coverage","collect Dart test coverage reports","Collect coverage using the coverage packge and create an LCOV report",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1593,1594,1597],{"name":22,"slug":23,"type":14},{"name":1595,"slug":1596,"type":14},"Reporting","reporting",{"name":1573,"slug":1574,"type":14},"2026-07-15T05:22:21.38636",{"slug":1600,"name":1600,"fn":1601,"description":1602,"org":1603,"tags":1604,"stars":24,"repoUrl":25,"updatedAt":1609},"dart-fix-runtime-errors","debug and fix Dart runtime errors","Uses get_runtime_errors and lsp to fetch an active stack trace, locate the failing line, apply a fix, and verify resolution via hot_reload.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1605,1606],{"name":22,"slug":23,"type":14},{"name":1607,"slug":1608,"type":14},"Debugging","debugging","2026-07-15T05:22:22.622501",{"slug":1611,"name":1611,"fn":1612,"description":1613,"org":1614,"tags":1615,"stars":24,"repoUrl":25,"updatedAt":1618},"dart-generate-test-mocks","generate mock objects for Dart tests","Define and generate mock objects for external dependencies using `package:mockito` and `build_runner`. Use when unit testing classes that depend on complex external services like APIs or databases.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1616,1617],{"name":22,"slug":23,"type":14},{"name":1573,"slug":1574,"type":14},"2026-07-15T05:22:42.607449",{"slug":1620,"name":1620,"fn":1621,"description":1622,"org":1623,"tags":1624,"stars":24,"repoUrl":25,"updatedAt":1630},"dart-migrate-to-checks-package","migrate test matchers to checks package","Replace the usage of `expect` and similar functions from `package:matcher`\nto `package:checks` equivalents.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1625,1626,1629],{"name":22,"slug":23,"type":14},{"name":1627,"slug":1628,"type":14},"Migration","migration",{"name":1573,"slug":1574,"type":14},"2026-07-15T05:22:31.276564",{"slug":1632,"name":1632,"fn":1633,"description":1634,"org":1635,"tags":1636,"stars":24,"repoUrl":25,"updatedAt":1642},"dart-resolve-package-conflicts","resolve Dart package version conflicts","Workflow for fixing package version conflicts. Use this when `pub get` fails due to incompatible package versions.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1637,1638,1639],{"name":22,"slug":23,"type":14},{"name":1607,"slug":1608,"type":14},{"name":1640,"slug":1641,"type":14},"Engineering","engineering","2026-07-15T05:22:30.059335",{"items":1644,"total":956},[1645,1650,1655,1661,1666,1671,1677,1683,1695,1707,1721,1731],{"slug":1566,"name":1566,"fn":1567,"description":1568,"org":1646,"tags":1647,"stars":24,"repoUrl":25,"updatedAt":1575},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1648,1649],{"name":22,"slug":23,"type":14},{"name":1573,"slug":1574,"type":14},{"slug":1577,"name":1577,"fn":1578,"description":1579,"org":1651,"tags":1652,"stars":24,"repoUrl":25,"updatedAt":1586},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1653,1654],{"name":1583,"slug":1584,"type":14},{"name":22,"slug":23,"type":14},{"slug":1588,"name":1588,"fn":1589,"description":1590,"org":1656,"tags":1657,"stars":24,"repoUrl":25,"updatedAt":1598},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1658,1659,1660],{"name":22,"slug":23,"type":14},{"name":1595,"slug":1596,"type":14},{"name":1573,"slug":1574,"type":14},{"slug":1600,"name":1600,"fn":1601,"description":1602,"org":1662,"tags":1663,"stars":24,"repoUrl":25,"updatedAt":1609},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1664,1665],{"name":22,"slug":23,"type":14},{"name":1607,"slug":1608,"type":14},{"slug":1611,"name":1611,"fn":1612,"description":1613,"org":1667,"tags":1668,"stars":24,"repoUrl":25,"updatedAt":1618},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1669,1670],{"name":22,"slug":23,"type":14},{"name":1573,"slug":1574,"type":14},{"slug":1620,"name":1620,"fn":1621,"description":1622,"org":1672,"tags":1673,"stars":24,"repoUrl":25,"updatedAt":1630},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1674,1675,1676],{"name":22,"slug":23,"type":14},{"name":1627,"slug":1628,"type":14},{"name":1573,"slug":1574,"type":14},{"slug":1632,"name":1632,"fn":1633,"description":1634,"org":1678,"tags":1679,"stars":24,"repoUrl":25,"updatedAt":1642},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1680,1681,1682],{"name":22,"slug":23,"type":14},{"name":1607,"slug":1608,"type":14},{"name":1640,"slug":1641,"type":14},{"slug":1684,"name":1684,"fn":1685,"description":1686,"org":1687,"tags":1688,"stars":24,"repoUrl":25,"updatedAt":1694},"dart-run-static-analysis","run static analysis and apply fixes","Execute `dart analyze` to identify warnings and errors, and use `dart fix --apply` to automatically resolve mechanical lint issues. Use during development to ensure code quality and before committing changes.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1689,1692,1693],{"name":1690,"slug":1691,"type":14},"Code Analysis","code-analysis",{"name":22,"slug":23,"type":14},{"name":1607,"slug":1608,"type":14},"2026-07-15T05:22:23.861119",{"slug":1696,"name":1696,"fn":1697,"description":1698,"org":1699,"tags":1700,"stars":24,"repoUrl":25,"updatedAt":1706},"dart-setup-ffi-assets","package C\u002FC++ assets for Dart","Guides agents in compiling and packaging C\u002FC++ source code into dynamic or static libraries (Code Assets) using Dart's Native Assets hook system (via hook\u002Fbuild.dart and hook\u002Flink.dart utilizing package:hooks and package:native_toolchain_c). Use when a user asks to: 'setup native assets', 'compile C\u002FC++ source code', 'bundle dynamic libraries', 'build native C code', 'link native assets', 'implement build.dart or link.dart hooks', or 'integrate C\u002FC++ interop in Dart\u002FFlutter'. Helps agents avoid manual toolchain orchestration and configures secure hash-validated binary downloads or advanced linker tree-shaking with package:record_use mapping.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1701,1702,1705],{"name":22,"slug":23,"type":14},{"name":1703,"slug":1704,"type":14},"Deployment","deployment",{"name":1640,"slug":1641,"type":14},"2026-07-15T05:22:20.138636",{"slug":1708,"name":1708,"fn":1709,"description":1710,"org":1711,"tags":1712,"stars":24,"repoUrl":25,"updatedAt":1720},"dart-skills-lint-setup","configure dart_skills_lint for Dart projects","Use this skill when you need to set up validation for AI agent skills in a Dart project for the first time.\nAdds the linter as a dev_dependency, creates a configuration file, and generates a baseline for legacy repos.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1713,1714,1717],{"name":22,"slug":23,"type":14},{"name":1715,"slug":1716,"type":14},"Plugin Development","plugin-development",{"name":1718,"slug":1719,"type":14},"QA","qa","2026-07-15T05:22:47.488998",{"slug":1722,"name":1722,"fn":1723,"description":1724,"org":1725,"tags":1726,"stars":24,"repoUrl":25,"updatedAt":1730},"dart-skills-lint-validation","validate agent skills with dart_skills_lint","Use this skill when you need to validate AI agent skills with dart_skills_lint — running the linter, interpreting failures, fixing violations, and authoring custom rules.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1727,1728,1729],{"name":22,"slug":23,"type":14},{"name":1715,"slug":1716,"type":14},{"name":1718,"slug":1719,"type":14},"2026-07-21T05:38:34.451024",{"slug":1732,"name":1732,"fn":1733,"description":1734,"org":1735,"tags":1736,"stars":24,"repoUrl":25,"updatedAt":1739},"dart-use-ffigen","generate FFI bindings with ffigen","Guide agents to use `package:ffigen` to automatically generate FFI bindings instead of writing them manually. Use this skill when a task involves writing new FFI bindings, extending C\u002FObjective-C\u002FSwift integrations, or replacing hand-crafted `dart:ffi` setups.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1737,1738],{"name":22,"slug":23,"type":14},{"name":1640,"slug":1641,"type":14},"2026-07-15T05:22:17.592351"]