{"id":22179972,"url":"https://github.com/jahezacademy/flutter_rocket","last_synced_at":"2026-01-11T04:06:18.170Z","repository":{"id":37021602,"uuid":"337238669","full_name":"JahezAcademy/flutter_rocket","owner":"JahezAcademy","description":"🚀 Flutter Rocket 🚀  Fly high with Flutter Rocket - the ultimate package for Flutter developers","archived":false,"fork":false,"pushed_at":"2025-04-22T21:39:55.000Z","size":1916,"stargazers_count":13,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-06-22T11:07:35.482Z","etag":null,"topics":["flutter","http","model-view-controller","mvc","requests","state-management"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/flutter_rocket","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JahezAcademy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-08T23:31:21.000Z","updated_at":"2025-02-25T21:51:04.000Z","dependencies_parsed_at":"2024-07-07T23:45:02.937Z","dependency_job_id":"f37d8846-c9ef-4fe4-ba51-fd8068214316","html_url":"https://github.com/JahezAcademy/flutter_rocket","commit_stats":null,"previous_names":["jahezacademy/mvcrocket","jahezacademy/mvc_rocket"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/JahezAcademy/flutter_rocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JahezAcademy%2Fflutter_rocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JahezAcademy%2Fflutter_rocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JahezAcademy%2Fflutter_rocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JahezAcademy%2Fflutter_rocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JahezAcademy","download_url":"https://codeload.github.com/JahezAcademy/flutter_rocket/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JahezAcademy%2Fflutter_rocket/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261282321,"owners_count":23134940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutter","http","model-view-controller","mvc","requests","state-management"],"created_at":"2024-12-02T09:16:16.283Z","updated_at":"2026-01-11T04:06:18.158Z","avatar_url":"https://github.com/JahezAcademy.png","language":"Dart","readme":"# \u003cimg src=\"https://github.com/JahezAcademy/flutter_rocket/blob/dev/images/logo.png\" width=\"35\"\u003e Flutter Rocket \u003cimg src=\"https://github.com/JahezAcademy/flutter_rocket/blob/dev/images/logo.png\" width=\"35\"\u003e\n\n## Fly high with Flutter Rocket - the ultimate package for Flutter developers\n\n# Author: [Jahez team](https://github.com/JahezAcademy)\n\n[![Pub](https://img.shields.io/pub/v/flutter_rocket.svg)](https://pub.dartlang.org/packages/flutter_rocket)\n[![License: MIT](https://img.shields.io/badge/License-MIT-brown.svg)](https://opensource.org/licenses/MIT)\n[![Flutter CI](https://github.com/JahezAcademy/flutter_rocket/actions/workflows/flutter-ci.yml/badge.svg)](https://github.com/JahezAcademy/flutter_rocket/actions/workflows/flutter-ci.yml)\n\n## Graphic tutorial\n\n![JPG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/images/flutter_rocket_schema.jpg)\n[Open with miro](https://miro.com/app/board/uXjVPndHj2s=/?share_link_id=307293362528)\n\n---\n\n| Package                                                                                                    | Pub                                                                                                              |\n| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |\n| [flutter_rocket](https://github.com/JahezAcademy/flutter_rocket/tree/master/packages/flutter_rocket)       | [![pub package](https://img.shields.io/pub/v/flutter_rocket.svg)](https://pub.dev/packages/flutter_rocket)       |\n| [rocket_model](https://github.com/JahezAcademy/flutter_rocket/tree/master/packages/rocket_model)           | [![pub package](https://img.shields.io/pub/v/rocket_model.svg)](https://pub.dev/packages/rocket_model)           |\n| [rocket_client](https://github.com/JahezAcademy/flutter_rocket/tree/master/packages/rocket_client)         | [![pub package](https://img.shields.io/pub/v/rocket_client.svg)](https://pub.dev/packages/rocket_client)         |\n| [rocket_listenable](https://github.com/JahezAcademy/flutter_rocket/tree/master/packages/rocket_listenable) | [![pub package](https://img.shields.io/pub/v/rocket_listenable.svg)](https://pub.dev/packages/rocket_listenable) |\n| [rocket_view](https://github.com/JahezAcademy/flutter_rocket/tree/master/packages/rocket_view)             | [![pub package](https://img.shields.io/pub/v/rocket_view.svg)](https://pub.dev/packages/rocket_view)             |\n| [rocket_singleton](https://github.com/JahezAcademy/flutter_rocket/tree/master/packages/rocket_singleton)   | [![pub package](https://img.shields.io/pub/v/rocket_singleton.svg)](https://pub.dev/packages/rocket_singleton)   |\n| [rocket_mini_view](https://github.com/JahezAcademy/flutter_rocket/tree/master/packages/rocket_mini_view)   | [![pub package](https://img.shields.io/pub/v/rocket_mini_view.svg)](https://pub.dev/packages/rocket_mini_view)   |\n\n---\n\n# Usage\n\n## Simple case usage RocketMiniView \u0026 RocketValue\n\nits very simple\n\n```dart\nclass MiniViewRocket extends StatelessWidget {\n  final RocketValue\u003cString\u003e myStringValue = \"My Value\".mini;\n  final RocketValue\u003cint\u003e myIntValue = 2021.mini;\n\n  MiniViewRocket({Key? key}) : super(key: key);\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: Column(\n        mainAxisAlignment: MainAxisAlignment.center,\n        children: [\n          // use RocketValue for every widget\n          RocketMiniView(\n            value: myStringValue,\n            builder: () =\u003e Text(myStringValue.v),\n          ),\n          RocketMiniView(\n            value: myStringValue,\n            builder: () =\u003e Text(myIntValue.v.toString()),\n          ),\n          const SizedBox(\n            height: 25.0,\n          ),\n          // merge multi RocketValue in one widget\n          RocketMiniView(\n              value: RocketValue.merge([myStringValue, myIntValue]),\n              builder: () {\n                return Row(\n                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,\n                  children: [\n                    Text(myStringValue.v),\n                    Text(myIntValue.v.toString())\n                  ],\n                );\n              })\n        ],\n      ),\n      floatingActionButton: FloatingActionButton(\n        backgroundColor: Theme.of(context).primaryColor,\n        onPressed: () {\n          // change value\n          myStringValue.v = \"Value Changed\";\n          myIntValue.v = 2022;\n        },\n        tooltip: 'change Value',\n        child: const Icon(Icons.change_circle),\n      ),\n    );\n  }\n}\n\n\n```\n\n## State management \u0026 request\n\nfirstly you need to create your model by your json data from this [Link](https://json2dart.web.app/)\nyou get something like this:\n\n```dart\nimport 'package:flutter_rocket/flutter_rocket.dart';\n\nString postUserIdField = \"userId\";\nString postIdField = \"id\";\nString postTitleField = \"title\";\nString postBodyField = \"body\";\n\nclass Post extends RocketModel\u003cPost\u003e {\n  int? userId;\n  int? id;\n  String? title;\n  String? body;\n  // disable logs debugging\n  @override\n  bool get enableDebug =\u003e false;\n  Post({\n    this.userId,\n    this.id,\n    this.title,\n    this.body,\n  });\n\n  @override\n  void fromJson(covariant Map\u003cString, dynamic\u003e json, {bool isSub = false}) {\n    userId = json[postUserIdField] ?? userId;\n    id = json[postIdField] ?? id;\n    title = json[postTitleField] ?? title;\n    body = json[postBodyField] ?? body;\n    super.fromJson(json, isSub: isSub);\n  }\n\n  void updateFields({\n    int? userIdField,\n    int? idField,\n    String? titleField,\n    String? bodyField,\n  }) {\n    userId = userIdField ?? userId;\n    id = idField ?? id;\n    title = titleField ?? title;\n    body = bodyField ?? body;\n    rebuildWidget();\n  }\n\n  @override\n  Map\u003cString, dynamic\u003e toJson() {\n    final Map\u003cString, dynamic\u003e data = {};\n    data[postUserIdField] = userId;\n    data[postIdField] = id;\n    data[postTitleField] = title;\n    data[postBodyField] = body;\n\n    return data;\n  }\n\n  @override\n  get instance =\u003e Post();\n}\n\n```\n\nNow second step create your RocketRequest in constructor or initState of first widget and pass url \u0026 headers\n\n```dart\nclass MyApp extends StatelessWidget {\n  MyApp() {\n    const String baseUrl = 'https://jsonplaceholder.typicode.com';\n    // create request object\n    RocketRequest request = RocketRequest(url: baseUrl);\n    // save it, for use it from any screen by key\n    Rocket.add(rocketRequestKey, request);\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      ...\n    );\n  }\n}...\n```\n\nNow create request method for post\n\n```dart\nimport 'package:example/models/post_model.dart';\nimport 'package:flutter_rocket/flutter_rocket.dart';\n\nconst String postsEndpoint = \"posts\";\n\nclass GetPosts {\n  static Future getPosts(Post postModel) =\u003e\n      Rocket.get(rocketRequestKey).request(\n        // endpoint\n        postsEndpoint,\n        // your model\n        model: postModel,\n        // parameters for send it with request\n        // params:{\"key\":\"value\"},\n        // inspect method for determine exact json use for generate your model in first step\n        // if your api send data directly without any supplement values you not should define it\n        // inspect:(data)=\u003edata[\"response\"]\n        // or\n        // target: ['response']\n      );\n}\n```\n\nNext step its build [RocketView] Widget \u0026 pass your [RocketModel] in [model] \u0026 [RocketRequest] method in [call] parameter\n\n```dart\n\nclass PostExample extends StatelessWidget {\n  // Save your model to use on another screen\n  // readOnly means if you close and open this screen you will use same data without update it from Api\n  // [rocket] is instance of Mccontroller injected in Object by extension for use it easily anywhere\n  final Post post = Rocket.add\u003cPost\u003e(postsEndpoint, Post(), readOnly: true);\n\n  PostExample({Key? key, required this.title}) : super(key: key);\n  final String title;\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n        appBar: AppBar(\n          title: const Text(\n            \"Refresh Posts with swip to down or from here =\u003e\",\n            style: TextStyle(fontSize: 11.0),\n          ),\n          actions: [\n            IconButton(\n                icon: const Icon(Icons.data_usage),\n                // Refresh Data from Api\n                onPressed: () =\u003e GetPosts.getPosts(post))\n          ],\n        ),\n        body: SizedBox(\n          height: MediaQuery.of(context).size.height,\n          width: MediaQuery.of(context).size.width,\n          child: RefreshIndicator(\n              onRefresh: () {\n                return GetPosts.getPosts(post);\n              },\n              child: RocketView(\n                // call api method\n                fetch: () =\u003e GetPosts.getPosts(post),\n                // your model generated\n                model: post,\n                // call call Voidcallback if model empty\n                callType: CallType.callIfModelEmpty,\n                // or\n                // callType: CallType.callAsStream,\n                // secondsOfStream: 1,\n                // customized your loading (default widget is CircularProgressIndicator)\n                // loader:CustomLoading(),\n\n                // handle errors\n                onError: (RocketException exception, Function() reload) {\n                  return Center(\n                    child: Column(\n                      mainAxisAlignment: MainAxisAlignment.center,\n                      children: [\n                        Text(exception.exception),\n                        if (exception.statusCode != HttpStatus.ok) ...[\n                          Text(exception.response),\n                          Text(Rocket.get(rocketRequestKey)\n                              .msgByStatusCode(exception.statusCode))\n                        ],\n                        TextButton(\n                            onPressed: reload, child: const Text(\"retry\"))\n                      ],\n                    ),\n                  );\n                },\n                builder: (context,state) {\n                  return SizedBox(\n                    height: MediaQuery.of(context).size.height * 0.852,\n                    child: ListView.builder(\n                      itemCount: post.all!.length,\n                      itemBuilder: (BuildContext context, int index) {\n                        // your data saved in multi list as Post model\n                        Post currentPost = post.all![index];\n                        return ListTile(\n                            leading: Text(currentPost.id.toString()),\n                            title: Text(currentPost.title!),\n                            trailing: IconButton(\n                              color: Colors.brown,\n                              icon: const Icon(Icons.update),\n                              onPressed: () {\n                                List titles = post.all!\n                                    .toJson(\n                                        include: [\"title\"], onlyValues: true)\n                                    .map((e) =\u003e e[0])\n                                    .toList();\n                                log(\"$titles\");\n                                // update post data\n                                currentPost.updateFields(\n                                    titleField: \"This Title changed\");\n                              },\n                            ),\n                            onTap: () =\u003e Navigator.of(context).push(\n                                  MaterialPageRoute(\n                                      builder: (BuildContext context) {\n                                    return Details(index);\n                                  }),\n                                ));\n                      },\n                    ),\n                  );\n                },\n              )),\n        ));\n  }\n}\n\nclass Details extends StatelessWidget {\n  final int index;\n  //  get your model by key or type\n  final Post post = Rocket.get\u003cPost\u003e();\n  Details(this.index, {Key? key}) : super(key: key);\n  @override\n  Widget build(BuildContext context) {\n    Post currentPost = post.all![index];\n    return Scaffold(\n      appBar: AppBar(title: Text(currentPost.title!)),\n      body: Center(\n        child: ListTile(\n          leading: Text(currentPost.id.toString()),\n          title: Text(currentPost.title!),\n          subtitle: Text(currentPost.body!),\n        ),\n      ),\n    );\n  }\n}\n\n```\n\n\u0026 last item its Rocket for save your model or any value and get it anywhere by key\n\n[Rocket object details](https://github.com/JahezAcademy/flutter_rocket/tree/dev/packages/rocket_singleton)\n\n## [More examples](https://github.com/JahezAcademy/flutter_rocket/tree/main/example)\n\nIf you have any questions or issues, feel free to check out the [Flutter Rocket GitHub repository](https://github.com/JahezAcademy/flutter_rocket) or ask for help on the [flutter_rocket package Discussions](https://github.com/JahezAcademy/flutter_rocket/discussions).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahezacademy%2Fflutter_rocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjahezacademy%2Fflutter_rocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahezacademy%2Fflutter_rocket/lists"}