diff --git a/README.md b/README.md index ba510b0..e981215 100644 --- a/README.md +++ b/README.md @@ -1,152 +1,103 @@ -# Flutter Rocket +# Flutter Rocket -## Fly high with Flutter Rocket - the ultimate package for Flutter developers - -# Author: [Jahez team](https://github.com/JahezAcademy) +**The ultimate power-up for your Flutter state management and API integration.** [![Pub](https://img.shields.io/pub/v/flutter_rocket.svg)](https://pub.dartlang.org/packages/flutter_rocket) -[![License: MIT](https://img.shields.io/badge/License-MIT-brown.svg)](https://opensource.org/licenses/MIT) +[![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://opensource.org/licenses/MIT) [![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) -## Graphic tutorial +Flutter Rocket is a high-performance, lightweight state management and API integration solution. It simplifies how you handle data from your backend to your UI while providing premium performance optimizations out of the box. + +--- -![JPG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/images/flutter_rocket_schema.jpg) -[Open with miro](https://miro.com/app/board/uXjVPndHj2s=/?share_link_id=307293362528) +## πŸš€ Key Features + +- ⚑ **Ultra Performance**: Selective rebuilds ensure only necessary widgets update. +- πŸ”— **Seamless API Integration**: Built-in client with support for interceptors and caching. +- πŸ› οΈ **Powerful Tooling**: Generate optimized models instantly using [Rocket CLI](https://pub.dev/packages/rocket_cli). +- πŸ“‰ **Minimal Boilerplate**: Write less code, build more features. +- πŸ“¦ **Modular Architecture**: Use only what you need (Listenables, Models, Clients, Views). +- πŸ›‘οΈ **Type Safe**: Fully typed models and requests. --- -| Package | Pub | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| [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) | -| [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) | -| [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) | -| [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) | -| [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) | -| [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) | -| [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) | +## πŸ“¦ Package Ecosystem + +| Package | Version | Description | +| --- | --- | --- | +| [flutter_rocket](https://pub.dev/packages/flutter_rocket) | [![pub package](https://img.shields.io/pub/v/flutter_rocket.svg)](https://pub.dev/packages/flutter_rocket) | Core bundle for Flutter. | +| [rocket_model](https://pub.dev/packages/rocket_model) | [![pub package](https://img.shields.io/pub/v/rocket_model.svg)](https://pub.dev/packages/rocket_model) | Base model and state logic. | +| [rocket_client](https://pub.dev/packages/rocket_client) | [![pub package](https://img.shields.io/pub/v/rocket_client.svg)](https://pub.dev/packages/rocket_client) | HTTP client with caching. | +| [rocket_view](https://pub.dev/packages/rocket_view) | [![pub package](https://img.shields.io/pub/v/rocket_view.svg)](https://pub.dev/packages/rocket_view) | UI state management widgets. | +| [rocket_cli](https://pub.dev/packages/rocket_cli) | [![pub package](https://img.shields.io/pub/v/rocket_cli.svg)](https://pub.dev/packages/rocket_cli) | CLI for model generation. | --- -# Usage +## πŸ“– Table of Contents +- [Graphic Tutorial](#-graphic-tutorial) +- [Installation](#-installation) +- [Quick Start](#-quick-start) +- [Core Concepts](#-core-concepts) + - [RocketModel](#rocketmodel) + - [RocketClient](#rocketclient) + - [RocketView](#rocketview) +- [Premium Optimizations](#-premium-optimizations) + - [Selective Rebuilds](#selective-rebuilds) + - [Automatic Bubbling](#automatic-bubbling) +- [Advanced Features](#-advanced-features) + - [Interceptors](#interceptors) + - [Caching](#caching) +- [Rocket CLI](#-rocket-cli) -## Simple case usage RocketMiniView & RocketValue +--- -its very simple +## 🎨 Graphic Tutorial -```dart -class MiniViewRocket extends StatelessWidget { - final RocketValue myStringValue = "My Value".mini; - final RocketValue myIntValue = 2021.mini; +![Flutter Rocket Architecture](https://github.com/JahezAcademy/flutter_rocket/blob/dev/images/flutter_rocket_schema.jpg) +[Explore the Miro Board](https://miro.com/app/board/uXjVPndHj2s=/?share_link_id=307293362528) - MiniViewRocket({Key? key}) : super(key: key); - @override - Widget build(BuildContext context) { - return Scaffold( - body: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // use RocketValue for every widget - RocketMiniView( - value: myStringValue, - builder: () => Text(myStringValue.v), - ), - RocketMiniView( - value: myStringValue, - builder: () => Text(myIntValue.v.toString()), - ), - const SizedBox( - height: 25.0, - ), - // merge multi RocketValue in one widget - RocketMiniView( - value: RocketValue.merge([myStringValue, myIntValue]), - builder: () { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text(myStringValue.v), - Text(myIntValue.v.toString()) - ], - ); - }) - ], - ), - floatingActionButton: FloatingActionButton( - backgroundColor: Theme.of(context).primaryColor, - onPressed: () { - // change value - myStringValue.v = "Value Changed"; - myIntValue.v = 2022; - }, - tooltip: 'change Value', - child: const Icon(Icons.change_circle), - ), - ); - } -} +--- + +## πŸ“¦ Installation +Add this to your `pubspec.yaml`: +```yaml +dependencies: + flutter_rocket: ^latest_version ``` -## State management & request +--- + +## ⚑ Quick Start -firstly you need to create your model by your json data from this [Link](https://json2dart.web.app/) -you get something like this: +### 1. Define your Model +Use **Rocket CLI** to generate this automatically, or define it manually: ```dart import 'package:flutter_rocket/flutter_rocket.dart'; -String postUserIdField = "userId"; -String postIdField = "id"; -String postTitleField = "title"; -String postBodyField = "body"; +const String postTitleField = "title"; class Post extends RocketModel { - int? userId; - int? id; String? title; - String? body; - // disable logs debugging - @override - bool get enableDebug => false; - Post({ - this.userId, - this.id, - this.title, - this.body, - }); + + Post({this.title}); @override - void fromJson(covariant Map json, {bool isSub = false}) { - userId = json[postUserIdField] ?? userId; - id = json[postIdField] ?? id; - title = json[postTitleField] ?? title; - body = json[postBodyField] ?? body; + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; + title = json[postTitleField]; super.fromJson(json, isSub: isSub); } - void updateFields({ - int? userIdField, - int? idField, - String? titleField, - String? bodyField, - }) { - userId = userIdField ?? userId; - id = idField ?? id; - title = titleField ?? title; - body = bodyField ?? body; - rebuildWidget(); - } - - @override - Map toJson() { - final Map data = {}; - data[postUserIdField] = userId; - data[postIdField] = id; - data[postTitleField] = title; - data[postBodyField] = body; - - return data; + void updateFields({String? titleField}) { + List fields = []; + if (titleField != null) { + title = titleField; + fields.add(postTitleField); + } + rebuildWidget(fromUpdate: true, fields: fields.isEmpty ? null : fields); } @override @@ -154,252 +105,116 @@ class Post extends RocketModel { } ``` -### Advanced Optimization: Automatic Bubbling -`RocketModel` now automatically handles notification bubbling. If you have a collection of models (e.g. `Posts` containing `Post`), any change to an individual `Post` will automatically notify the `Posts` parent and rebuild any `RocketView` listening to it. This eliminates the need for manual listener management in your UI. - -``` - -### Selective Rebuilds -For complex models, you can optimize performance by rebuilding widgets only when specific fields change: - -1. Specify fields in `RocketView`: -```dart -RocketView( - model: userModel, - fields: ['avatarUrl'], // Only listen to avatarUrl - builder: (context, state) => Image.network(userModel.avatarUrl), -) -``` +### 2. Setup the Client +Initialize your client and save it to the Rocket singleton: -2. Notify for those fields in your model: ```dart -void updateAvatar(String newUrl) { - avatarUrl = newUrl; - rebuildWidget(fields: ['avatarUrl']); // Only notifies avatarUrl listeners +void main() { + RocketRequest request = RocketRequest(url: 'https://jsonplaceholder.typicode.com'); + Rocket.add(rocketRequestKey, request); + runApp(MyApp()); } ``` -This prevents the "Profile Picture" from rebuilding if the user's "Bio" or "Points" change. -Now second step create your RocketRequest in constructor or initState of first widget and pass url & headers +### 3. Bind UI with RocketView +Display your data effortlessly: ```dart -class MyApp extends StatelessWidget { - MyApp() { - const String baseUrl = 'https://jsonplaceholder.typicode.com'; - // create request object - RocketRequest request = RocketRequest(url: baseUrl); - // save it, for use it from any screen by key - Rocket.add(rocketRequestKey, request); - } +class PostList extends StatelessWidget { + final Post postModel = Post(); @override Widget build(BuildContext context) { - return MaterialApp( - ... + return RocketView( + model: postModel, + fetch: () => Rocket.get(rocketRequestKey).request('posts', model: postModel), + builder: (context, state) { + return ListView.builder( + itemCount: postModel.all!.length, + itemBuilder: (context, index) { + final post = postModel.all![index]; + return Text(post.title!); + }, + ); + }, ); } -}... -``` - -Now create request method for post - -```dart -import 'package:example/models/post_model.dart'; -import 'package:flutter_rocket/flutter_rocket.dart'; - -const String postsEndpoint = "posts"; - -class GetPosts { - static Future getPosts(Post postModel) => - Rocket.get(rocketRequestKey).request( - // endpoint - postsEndpoint, - // your model - model: postModel, - // parameters for send it with request - // params:{"key":"value"}, - // inspect method for determine exact json use for generate your model in first step - // if your api send data directly without any supplement values you not should define it - // inspect:(data)=>data["response"] - // or - // target: ['response'] - ); } ``` -Next step its build [RocketView] Widget & pass your [RocketModel] in [model] & [RocketRequest] method in [call] parameter - -```dart - -class PostExample extends StatelessWidget { - // Save your model to use on another screen - // readOnly means if you close and open this screen you will use same data without update it from Api - // [rocket] is instance of Mccontroller injected in Object by extension for use it easily anywhere - final Post post = Rocket.add(postsEndpoint, Post(), readOnly: true); +--- - PostExample({Key? key, required this.title}) : super(key: key); - final String title; - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text( - "Refresh Posts with swip to down or from here =>", - style: TextStyle(fontSize: 11.0), - ), - actions: [ - IconButton( - icon: const Icon(Icons.data_usage), - // Refresh Data from Api - onPressed: () => GetPosts.getPosts(post)) - ], - ), - body: SizedBox( - height: MediaQuery.of(context).size.height, - width: MediaQuery.of(context).size.width, - child: RefreshIndicator( - onRefresh: () { - return GetPosts.getPosts(post); - }, - child: RocketView( - // call api method - fetch: () => GetPosts.getPosts(post), - // your model generated - model: post, - // call call Voidcallback if model empty - callType: CallType.callIfModelEmpty, - // or - // callType: CallType.callAsStream, - // secondsOfStream: 1, - // customized your loading (default widget is CircularProgressIndicator) - // loader:CustomLoading(), // Optional: default is CircularProgressIndicator - - // handle errors - onError: (RocketException exception, Function() reload) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(exception.exception), - if (exception.statusCode != HttpStatus.ok) ...[ - Text(exception.response), - Text(Rocket.get(rocketRequestKey) - .msgByStatusCode(exception.statusCode)) - ], - TextButton( - onPressed: reload, child: const Text("retry")) - ], - ), - ); - }, - builder: (context,state) { - return SizedBox( - height: MediaQuery.of(context).size.height * 0.852, - child: ListView.builder( - itemCount: post.all!.length, - itemBuilder: (BuildContext context, int index) { - // your data saved in multi list as Post model - Post currentPost = post.all![index]; - return ListTile( - leading: Text(currentPost.id.toString()), - title: Text(currentPost.title!), - trailing: IconButton( - color: Colors.brown, - icon: const Icon(Icons.update), - onPressed: () { - List titles = post.all! - .toJson( - include: ["title"], onlyValues: true) - .map((e) => e[0]) - .toList(); - log("$titles"); - // update post data - currentPost.updateFields( - titleField: "This Title changed"); - }, - ), - onTap: () => Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) { - return Details(index); - }), - )); - }, - ), - ); - }, - )), - )); - } -} +## ✨ Premium Optimizations -class Details extends StatelessWidget { - final int index; - // get your model by key or type - final Post post = Rocket.get(); - Details(this.index, {Key? key}) : super(key: key); - @override - Widget build(BuildContext context) { - Post currentPost = post.all![index]; - return Scaffold( - appBar: AppBar(title: Text(currentPost.title!)), - body: Center( - child: ListTile( - leading: Text(currentPost.id.toString()), - title: Text(currentPost.title!), - subtitle: Text(currentPost.body!), - ), - ), - ); - } -} +### Selective Rebuilds +Stop rebuilding your entire list when only one item changes. Specify fields in `RocketView` to listen to specific property updates. +```dart +RocketView( + model: currentPost, + fields: [postTitleField], // Only rebuilds when 'title' changes + builder: (context, state) => Text(currentPost.title!), +) ``` -& last item its Rocket for save your model or any value and get it anywhere by key +### Automatic Bubbling +Nested models automatically notify their parents. If a `Post` inside a `Posts` list updates, the list view is notified automatically without any extra code. + +--- -[Rocket object details](https://github.com/JahezAcademy/flutter_rocket/tree/dev/packages/rocket_singleton) +## πŸ› οΈ Advanced Features ### Interceptors -You can now add interceptors to your `RocketClient` to handle global logic like adding Auth tokens or logging: +Handle global logic like Auth headers or logging: ```dart -RocketClient client = RocketClient( +RocketClient( url: 'https://api.example.com', beforeRequest: (request) { - request.headers['Authorization'] = 'Bearer token'; + request.headers['Authorization'] = 'Bearer your_token'; return request; }, - afterResponse: (response) { - print('Status: ${response.statusCode}'); - return response; - } ); ``` ### Caching -`RocketClient` now supports dynamic caching with `rocket_cache`. +Speed up your app with built-in caching: -1. Initialize its storage (usually in `main`): ```dart -void main() async { - WidgetsFlutterBinding.ensureInitialized(); - await RocketCache.init(); - runApp(MyApp()); -} -``` +RocketCache.init(); // Initialize first -2. Use it in your requests: -```dart client.request( 'posts', model: post, - cacheKey: 'all_posts', // Unique key for this request - cacheDuration: Duration(days: 1), // Optional: auto-expire after 1 day + cacheKey: 'all_posts', + cacheDuration: Duration(days: 1), ); ``` -Data will be loaded from cache instantly if available. -## [More examples](https://github.com/JahezAcademy/flutter_rocket/tree/main/example) +--- + +## πŸ› οΈ Rocket CLI + +Generate your optimized models instantly from JSON strings or files. + +```bash +# Install +dart pub global activate rocket_cli + +# Run +rocket_cli -j '{"id":1, "title":"Hello"}' -n Post +``` + +--- + +## πŸ”— Links & Support + +| Resource | Link | +| --- | --- | +| **Documentation** | [Wiki](https://github.com/JahezAcademy/flutter_rocket/wiki) | +| **Examples** | [GitHub Examples](https://github.com/JahezAcademy/flutter_rocket/tree/main/example) | +| **Community** | [Discussions](https://github.com/JahezAcademy/flutter_rocket/discussions) | +| **Bugs** | [Issue Tracker](https://github.com/JahezAcademy/flutter_rocket/issues) | -If 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). +# Author +Built with ❀️ by the **[Jahez Team](https://github.com/JahezAcademy)**. diff --git a/docs/wiki/Automatic-Bubbling.md b/docs/wiki/Automatic-Bubbling.md new file mode 100644 index 0000000..52b464a --- /dev/null +++ b/docs/wiki/Automatic-Bubbling.md @@ -0,0 +1,55 @@ +# Automatic Bubbling + +**Automatic Bubbling** is a built-in orchestration feature in Flutter Rocket that eliminates the need for manual listener management when working with nested models or collections. It ensures that changes in a child model are automatically "bubbled up" to the parent, triggering a rebuild in any widget listening to the parent. + +## The Problem + +In most state management systems, if you have a list of items (e.g., `Posts`) and you update a property of a single item (e.g., `Post.title`), the list widget itself won't know it needs to rebuild unless you manually notify it or use complex nested listeners. + +## The Solution + +In Flutter Rocket, every `RocketModel` is "bubbling-aware." When a model is part of a collection (the `all` list), any call to `rebuildWidget()` on the child model automatically triggers a notification to the parent collection. + +## How it Works + +Imagine you have a `Posts` model that contains a list of single `Post` items. + +1. **The UI**: You have a `RocketView` listening to the `Posts` model. +2. **The Action**: You change the title of `post[5]` using `currentPost.updateFields(...)`. +3. **The Bubbling**: + - `currentPost` calls its listeners (if any selective rebuild fields match). + - `currentPost` then notifies its parent (`Posts`). + - The `RocketView` listening to `Posts` receives the notification and rebuilds. + +## Benefits + +- **Zero Extra Code**: You don't need to add special "notifyParent" logic. +- **Consistent UI**: Your list views, counters, or summary widgets stay in sync with the individual items they contain. +- **Simplified Architecture**: You can treat your data tree as a single source of truth without worrying about wiring up listeners at every level. + +## Example + +```dart +// Parent View +RocketView( + model: postModel, // This is a list of posts + builder: (context, state) { + return ListView.builder( + itemCount: postModel.all!.length, + itemBuilder: (context, index) { + final post = postModel.all![index]; + return ListTile( + title: Text(post.title!), + onTap: () { + // Updating the CHILD automatically triggers a rebuild of this PARENT list + post.updateFields(titleField: 'Updated Title!'); + }, + ); + }, + ); + }, +) +``` + +## Performance Note +While bubbling is convenient, it triggers a rebuild of the parent widget. For extreme performance in large lists, combine Bubbling with [**Selective Rebuilds**](Selective-Rebuilds) by wrapping list items in their own `RocketView` to localize updates. diff --git a/docs/wiki/Home.md b/docs/wiki/Home.md new file mode 100644 index 0000000..7dae5fe --- /dev/null +++ b/docs/wiki/Home.md @@ -0,0 +1,33 @@ +# Welcome to the Flutter Rocket Wiki + +**Flutter Rocket** is a high-performance, lightweight state management and API integration solution for Flutter. It is designed to be simple, fast, and feature-rich, providing everything you need to build scalable applications. + +## πŸš€ Navigation + +### Core Concepts +- [**RocketModel**](RocketModel): The heart of your state. Learn how to define data and manage its logic. +- [**RocketClient**](RocketClient): Powerful HTTP requests, interceptors, and caching. +- [**RocketView**](RocketView): The bridge between your data and the UI. + +### Performance & Optimization +- [**Selective Rebuilds**](Selective-Rebuilds): High-performance UI updates by rebuilding only what changed. +- [**Automatic Bubbling**](Automatic-Bubbling): How nested models notify their parents automatically. + +### Tools +- [**Rocket CLI**](RocketCLI): Generate optimized models instantly from JSON. + +--- + +## Why Flutter Rocket? + +1. **Lightweight**: Zero external dependencies (other than core libraries). +2. **Performance First**: Optimized for minimum rebuilds and memory usage. +3. **Productivity**: Built-in tools and patterns to reduce boilerplate. +4. **Flexible**: Use as much or as little as you need. + +## Community & Support +- **General Support**: [GitHub Discussions](https://github.com/JahezAcademy/flutter_rocket/discussions) +- **Reporting Bugs**: [GitHub Issues](https://github.com/JahezAcademy/flutter_rocket/issues) +- **Examples**: [Example Project](https://github.com/JahezAcademy/flutter_rocket/tree/main/example) + +Built with ❀️ by the [Jahez Team](https://github.com/JahezAcademy). diff --git a/docs/wiki/RocketCLI.md b/docs/wiki/RocketCLI.md new file mode 100644 index 0000000..a42ec70 --- /dev/null +++ b/docs/wiki/RocketCLI.md @@ -0,0 +1,46 @@ +# Rocket CLI + +`rocket_cli` is a command-line tool designed to eliminate the boilerplate of creating `RocketModel` classes. It converts any JSON (from a string or a file) into fully optimized Dart code. + +## Installation + +Activate the CLI globally using Dart: + +```bash +dart pub global activate rocket_cli +``` + +## Usage + +You can generate a model from a JSON string: + +```bash +rocket_cli -j '{"id": 1, "name": "John"}' -n User +``` + +Or from a JSON file: + +```bash +rocket_cli -f data.json -n Result +``` + +## Features + +- **Automatic Serialization**: Generates `fromJson` and `toJson` methods. +- **Field Constants**: Automatically creates `const` strings for field keys to prevent typos. +- **Performance Optimized**: Generates `updateFields` logic with built-in support for **Selective Rebuilds**. +- **Nested Detection**: Automatically detects nested objects and lists, generating appropriate sub-models. +- **DateTime Support**: Automatically detects and handles ISO8601 date strings. + +## Generated Model Structure + +When you run the tool, it creates a Dart file containing: +1. **Constants**: `const String userIdField = "id";` +2. **Model Class**: `class User extends RocketModel { ... }` +3. **Methods**: + * `fromJson`: To parse API data. + * `toJson`: To send data back. + * `updateFields`: Optimized for high-performance state updates. + +## Why use it? +Manually writing model serialization is error-prone and tedious. `rocket_cli` ensures your models are consistent, follow best practices, and are optimized for the latest features of Flutter Rocket. diff --git a/docs/wiki/RocketClient.md b/docs/wiki/RocketClient.md new file mode 100644 index 0000000..4d528c2 --- /dev/null +++ b/docs/wiki/RocketClient.md @@ -0,0 +1,81 @@ +# RocketClient + +`RocketClient` is a powerful HTTP client built into Flutter Rocket. It handles requests, responses, state transitions in models, and includes features like interceptors and caching. + +## Basic Usage + +Initialize the client with a base URL: + +```dart +final client = RocketClient(url: 'https://api.example.com'); +``` + +## Making Requests + +Use the `request` method to fetch data. It automatically handles the `RocketModel` state. + +```dart +await client.request( + 'posts', + model: postModel, + method: RocketMethods.get, // Default is GET +); +``` + +### Request Parameters +- `model`: The `RocketModel` that will store the response. +- `params`: Query parameters. +- `data`: Request body (for POST/PUT). +- `target`: If the data you want is nested in the JSON response (e.g., `['data', 'items']`). + +## Interceptors + +Interceptors allow you to run code before a request is sent or after a response is received. + +```dart +final client = Rocketγ‚―γƒ©γ‚€γ‚’γƒ³γƒˆ( + url: 'https://api.example.com', + beforeRequest: (request) { + // Add Auth token + request.headers['Authorization'] = 'Bearer your_token'; + return request; + }, + afterResponse: (response) { + // Log status or refresh token + print('Status: ${response.statusCode}'); + return response; + }, +); +``` + +## Caching + +Speed up your app by caching network responses. + +1. **Initialize Caching**: +```dart +void main() async { + await RocketCache.init(); + runApp(MyApp()); +} +``` + +2. **Use in Request**: +```dart +client.request( + 'posts', + model: postModel, + cacheKey: 'posts_cache', + cacheDuration: Duration(hours: 1), +); +``` + +## Multi-Part Requests (Files) + +```dart +client.sendFile( + 'upload', + fields: {'name': 'profile'}, + files: {'avatar': 'path/to/image.png'}, +); +``` diff --git a/docs/wiki/RocketModel.md b/docs/wiki/RocketModel.md new file mode 100644 index 0000000..da745da --- /dev/null +++ b/docs/wiki/RocketModel.md @@ -0,0 +1,79 @@ +# RocketModel + +`RocketModel` is the base class for all your data models. It provides built-in state management, JSON serialization, and notification logic. + +## Defining a Model + +A `RocketModel` typically consists of: +1. **Properties**: Your data fields. +2. **Field Constants**: String keys matched to JSON keys. +3. **fromJson**: Logic to populate fields from a Map. +4. **updateFields**: Logic to update specific fields and trigger selective rebuilds. + +### Example Model + +```dart +import 'package:flutter_rocket/flutter_rocket.dart'; + +// 1. Define field keys as constants for reliability +const String userIdField = "userId"; +const String idField = "id"; +const String titleField = "title"; + +class Post extends RocketModel { + // 2. Properties + int? userId; + int? id; + String? title; + + Post({this.userId, this.id, this.title}); + + // 3. Populate from JSON + @override + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; + userId = json[userIdField]; + id = json[idField]; + title = json[titleField]; + super.fromJson(json, isSub: isSub); + } + + // 4. Update fields and trigger selective rebuilds + void updateFields({int? userIdField, int? idField, String? titleField}) { + List fields = []; + if (userIdField != null) { + userId = userIdField; + fields.add(userIdField); + } + // ... add logic for other fields + rebuildWidget(fromUpdate: true, fields: fields.isEmpty ? null : fields); + } + + @override + Post get instance => Post(); +} +``` + +## State Management + +Every `RocketModel` has a `state` property of type `RocketState`: +- `RocketState.loading`: Data is being fetched. +- `RocketState.done`: Data is loaded successfully. +- `RocketState.failed`: An error occurred. + +You can check the state in your UI to show loaders or error messages. + +## Data Collections + +When you fetch a list of items, the `all` property of the `RocketModel` holds the list. It is also an instance of `RocketModel` (or a subclass) that manages the list state. + +```dart +final Post posts = Post(); +// After fetching... +print(posts.all!.length); +``` + +## Tips +- Use **Rocket CLI** to generate these models instantly. +- Always use constant strings for field names to avoid typos. +- Override `enableDebug` to `true` during development to see state transition logs. diff --git a/docs/wiki/RocketView.md b/docs/wiki/RocketView.md new file mode 100644 index 0000000..d00b3b5 --- /dev/null +++ b/docs/wiki/RocketView.md @@ -0,0 +1,55 @@ +# RocketView + +`RocketView` is the primary widget used to bind your `RocketModel` to the UI. It automatically reacts to state changes (loading, done, failed) and rebuilds when data changes. + +## Basic Usage + +```dart +RocketView( + model: postModel, + fetch: () => client.request('posts', model: postModel), + builder: (context, state) { + return ListView.builder( + itemCount: postModel.all!.length, + itemBuilder: (context, index) => Text(postModel.all![index].title!), + ); + }, +) +``` + +## Parameters + +- `model`: The `RocketModel` instance to listen to. +- `fetch`: A function that makes the API call. Runs automatically based on `callType`. +- `builder`: The UI builder. Receives the current `RocketState`. +- `loader`: (Optional) Custom widget to show during `loading`. +- `onError`: (Optional) Custom widget to show on `failed`. Receives the exception and a reload function. +- `callType`: Determines when `fetch` is called: + - `CallType.callIfModelEmpty`: Only fetch if `model.all` is empty. + - `CallType.callAsStream`: Repeatedly fetch data every `secondsOfStream`. + - `CallType.callAsFuture`: Always fetch when the widget is initialized. + +## Performance Optimization + +Use the `fields` parameter to implement **Selective Rebuilds**. This tells `RocketView` to only rebuild if specific properties of the model change. + +```dart +RocketView( + model: currentPost, + fields: [postTitleField], // Only rebuilds if the 'title' property changes + builder: (context, state) => Text(currentPost.title!), +) +``` + +## Mini Views + +For simple local state (like a counter or a toggling boolean), use `RocketMiniView` with `RocketValue`. + +```dart +final count = 0.mini; + +RocketMiniView( + value: count, + builder: () => Text('Count: ${count.v}'), +) +``` diff --git a/docs/wiki/Selective-Rebuilds.md b/docs/wiki/Selective-Rebuilds.md new file mode 100644 index 0000000..fa4de20 --- /dev/null +++ b/docs/wiki/Selective-Rebuilds.md @@ -0,0 +1,69 @@ +# Selective Rebuilds + +Selective Rebuilds are a powerful optimization in Flutter Rocket that allows you to specify exactly which UI components should update when a model property changes. This prevents unnecessary rebuilds and keeps your app silky smooth, even with large data sets. + +## The Problem + +In traditional state management, updating a single property in an object often triggers a rebuild of every widget listening to that object. If you have a list of 100 items and update the title of one item, you don't want to rebuild the entire list or even the entire list item widget if only a small part of it changed. + +## The Solution + +Flutter Rocket solves this by allowing you to: +1. **Register listeners** for specific field names. +2. **Notify listeners** only for specific field names. + +## How to Implement + +### 1. In your Model +Update your model's `updateFields` method to track changed fields. + +```dart +void updateFields({String? titleField, String? bodyField}) { + List changedFields = []; + + if (titleField != null) { + title = titleField; + changedFields.add(postTitleField); + } + + if (bodyField != null) { + body = bodyField; + changedFields.add(postBodyField); + } + + // Notify only the widgets listening to these fields + rebuildWidget(fields: changedFields.isEmpty ? null : changedFields); +} +``` + +### 2. In your UI +Wrap your specific UI components in `RocketView` and provide the `fields` list. + +```dart +// This widget ONLY rebuilds when 'title' changes +RocketView( + model: post, + fields: [postTitleField], + builder: (context, state) => Text(post.title!), +) + +// This widget ONLY rebuilds when 'body' changes +RocketView( + model: post, + fields: [postBodyField], + builder: (context, state) => Text(post.body!), +) +``` + +## Why it's "Premium" Performance +- **Reduced Build Time**: Only the smallest necessary part of the UI tree is rebuilt. +- **CPU Savings**: Less work for the Flutter framework to diff the widget tree. +- **Battery Efficiency**: Lower energy consumption by minimizing rendering work. + +## Relationship with Automatic Bubbling +Selective Rebuilds used in conjunction with [**Automatic Bubbling**](Automatic-Bubbling) provide the ultimate performance strategy: +- **Bubbling** ensures the parent (like a list) knows an item changed. +- **Selective Rebuilds** ensure that only the specific property inside that item is redrawn, rather than the entire list entry. + +## Pro Tip +Using **Rocket CLI** version 1.1.0 or higher will automatically generate the `updateFields` logic for you, making this optimization effortless. diff --git a/packages/flutter_rocket/CHANGELOG.md b/packages/flutter_rocket/CHANGELOG.md index f2332b1..959b27c 100644 --- a/packages/flutter_rocket/CHANGELOG.md +++ b/packages/flutter_rocket/CHANGELOG.md @@ -1,56 +1,47 @@ +## 0.0.8 -## `0.0.1+1` -- Add example. -## `0.0.1+2` -- Add more Examples and add rebuild method in Model. -## `0.0.1+3` -- Support null safety -## `0.0.1+4` -- Change search parameter to params & add new parameter #path for get part of json & Add controller in model generator -## `0.0.1+5` -- fix bugs & add new item McController for add/get/remove your model Now you can use your model from another screen without traditional way -## `0.0.1+6` -- Optimization (add) method of McController & possible to add RocketRequest in controller -## `0.0.1+7` -- fix bugs -- Inject `mc` (instance) of McController in Stateless and ful widget by extension for use it easily -- remove path parameter -- add complex parameter for complex json -- add inspect parameter for complex json if complex true you need to define inspect by function return List of Map like this `{'item':'value1'},{'item':'value1'}` & if data already like this you dont need define complex and inspect -- add sendFile Method for send files -## `0.0.1+8` -- fix PUT bugs -- add params for post methods -- add setCookies parameter for enable and disable setCookie -## `0.0.1+9` -- Add generics types -- Add on RocketView `call` parameter for call request method & `callType` for define how call function will call (call as future or as stream or call when model is empty) & `secondsOfStream` for define seconds for update data from call method when choose callAsStream callType +- Support selective rebuilds for high performance. +- Optimization for `RocketModel` and `RocketView`. +- Improved field notification logic. -## `0.0.2` +## 0.0.7 -- fix some bugs & optimizated the code +* Fixed haskey method and get issues on `Rocket` -## `0.0.2+1` +## 0.0.6 -- add `onError` Function(error) parameter for getJson methods for handle errors & exceptions -- handle errors & exceptions in RocketView widget -- add `showExceptionDetails` parameter for show errors details in UI -- add `exception` & `statusCode` in `RocketModel` for models -- add `params` & `data` as body parameter for post methods -- add `debugging` parameter for enable or disable debugging -- add `RocketMiniView` & `RocketValue` for simple case -- add `merge` static method in `RocketValue` for use multiple `RocketValue` in one `RocketMiniView` -- replace exception & statusCode to RocketException bject for capture api, framework error -- create `RocketListenable` & use it instead of `ChangeNotifier` object -- add & call multi `VoidCallback` by one key -- use `RocketException` on setException of `RocketModel` instead of exception & statusCode -- add `onError` builder in `RocketView` for handle errors in widget -- removed `showExceptionDetails` parameter in `RocketView` -- removed `complex` parameter in `RocketRequest` methods -- in `RocketView` passed on `onError` builder `RocketException` msg of error and reload method for use it for retry -- removed unused parameter on `RocketView` Builder +* Fixed nullable value issue on `RocketValue` + +## 0.0.5 + +* Added retry options to `RocketClient` + +## 0.0.4 + +* Update RocketView + +## `1.0.2` + +- Use `enums` instead of `string` for http methods in `sendFile` method on `RocketRequest`. +- Add `RocketState` enums for manage model states (done,loading,failed). +- Add `enableDebug` on Models for log model state & duration of loading +- Optmized performance by manage rebuild widgets with `RocketState` +- Add log for exceptions +- Add `updateFields` method for update model by parameters +- Support rebuild widget from models of multi +- Add unit tests for examples +- Use `Rocket` instead of `RocketController` for save objects easily +- Make json (fromJson parameter) non nullable on `RocketModel`. +- Fix subListener issue on `RocketView` +- Enhanced RocketRequest object (used 1 method for all request methods) +- Removed `multi` parameter from RocketRequest method +- Added end2end test on example +- Renamed `multi` `RocketModel` field to `all` +- Added `targetData` parameter on `request` method of `RocketRequest` +- Added `forEach` method to `Rocket` ## `1.0.0` + # Change package name to πŸš€ MVCRocket πŸš€ - rename package from mc to MVCRocket πŸš€ - rename Objects @@ -70,39 +61,70 @@ - use `LinkedList` instead of `List` & add extensions needed - add const keys for RocketController `rocketRequestKey`, `sizeScreenKey` & `sizeDesignKey` -## `1.0.2` -- Use `enums` instead of `string` for http methods in `sendFile` method on `RocketRequest`. -- Add `RocketState` enums for manage model states (done,loading,failed). -- Add `enableDebug` on Models for log model state & duration of loading -- Optmized performance by manage rebuild widgets with `RocketState` -- Add log for exceptions -- Add `updateFields` method for update model by parameters -- Support rebuild widget from models of multi -- Add unit tests for examples -- Use `Rocket` instead of `RocketController` for save objects easily -- Make json (fromJson parameter) non nullable on `RocketModel`. -- Fix subListener issue on `RocketView` -- Enhanced RocketRequest object (used 1 method for all request methods) -- Removed `multi` parameter from RocketRequest method -- Added end2end test on example -- Renamed `multi` `RocketModel` field to `all` -- Added `targetData` parameter on `request` method of `RocketRequest` -- Added `forEach` method to `Rocket` +## `0.0.2+1` -/// New Updates +- add `onError` Function(error) parameter for getJson methods for handle errors & exceptions +- handle errors & exceptions in RocketView widget +- add `showExceptionDetails` parameter for show errors details in UI +- add `exception` & `statusCode` in `RocketModel` for models +- add `params` & `data` as body parameter for post methods +- add `debugging` parameter for enable or disable debugging +- add `RocketMiniView` & `RocketValue` for simple case +- add `merge` static method in `RocketValue` for use multiple `RocketValue` in one `RocketMiniView` +- replace exception & statusCode to RocketException bject for capture api, framework error +- create `RocketListenable` & use it instead of `ChangeNotifier` object +- add & call multi `VoidCallback` by one key +- use `RocketException` on setException of `RocketModel` instead of exception & statusCode +- add `onError` builder in `RocketView` for handle errors in widget +- removed `showExceptionDetails` parameter in `RocketView` +- removed `complex` parameter in `RocketRequest` methods +- in `RocketView` passed on `onError` builder `RocketException` msg of error and reload method for use it for retry +- removed unused parameter on `RocketView` Builder -## 0.0.4 +## `0.0.2` -* Update RocketView +- fix some bugs & optimizated the code -## 0.0.5 +## `0.0.1+9` -* Added retry options to `RocketClient` +- Add generics types +- Add on RocketView `call` parameter for call request method & `callType` for define how call function will call (call as future or as stream or call when model is empty) & `secondsOfStream` for define seconds for update data from call method when choose callAsStream callType -## 0.0.6 +## `0.0.1+8` -* Fixed nullable value issue on `RocketValue` +- fix PUT bugs +- add params for post methods +- add setCookies parameter for enable and disable setCookie -## 0.0.7 +## `0.0.1+7` + +- fix bugs +- Inject `mc` (instance) of McController in Stateless and ful widget by extension for use it easily +- remove path parameter +- add complex parameter for complex json +- add inspect parameter for complex json if complex true you need to define inspect by function return List of Map like this `{'item':'value1'},{'item':'value1'}` & if data already like this you dont need define complex and inspect +- add sendFile Method for send files + +## `0.0.1+6` + +- Optimization (add) method of McController & possible to add RocketRequest in controller + +## `0.0.1+5` + +- fix bugs & add new item McController for add/get/remove your model Now you can use your model from another screen without traditional way + +## `0.0.1+4` + +- Change search parameter to params & add new parameter #path for get part of json & Add controller in model generator + +## `0.0.1+3` + +- Support null safety + +## `0.0.1+2` + +- Add more Examples and add rebuild method in Model. + +## `0.0.1+1` -* Fixed haskey method and get issues on `Rocket \ No newline at end of file +- Add example. \ No newline at end of file diff --git a/packages/flutter_rocket/example/lib/models/post_model.dart b/packages/flutter_rocket/example/lib/models/post_model.dart index 483c94e..9c6712c 100755 --- a/packages/flutter_rocket/example/lib/models/post_model.dart +++ b/packages/flutter_rocket/example/lib/models/post_model.dart @@ -36,11 +36,24 @@ class Post extends RocketModel { String? titleField, String? bodyField, }) { - userId = userIdField ?? userId; - id = idField ?? id; - title = titleField ?? title; - body = bodyField ?? body; - rebuildWidget(fromUpdate: true); + List fields = []; + if (userIdField != null) { + userId = userIdField; + fields.add(postUserIdField); + } + if (idField != null) { + id = idField; + fields.add(postIdField); + } + if (titleField != null) { + title = titleField; + fields.add(postTitleField); + } + if (bodyField != null) { + body = bodyField; + fields.add(postBodyField); + } + rebuildWidget(fromUpdate: true, fields: fields.isEmpty ? null : fields); } @override diff --git a/packages/flutter_rocket/example/lib/views/post_view.dart b/packages/flutter_rocket/example/lib/views/post_view.dart index c0f595e..a9f266e 100755 --- a/packages/flutter_rocket/example/lib/views/post_view.dart +++ b/packages/flutter_rocket/example/lib/views/post_view.dart @@ -1,4 +1,3 @@ -import 'dart:developer'; import 'dart:io'; import 'package:example/models/post_model.dart'; @@ -80,25 +79,26 @@ class PostExample extends StatelessWidget { itemBuilder: (BuildContext context, int index) { // your data saved in multi list as Post model Post currentPost = post.all![index]; - return ListTile( - leading: Text(currentPost.id.toString()), - title: Text(currentPost.title!), - trailing: IconButton( - color: Colors.brown, - icon: const Icon(Icons.update), - onPressed: () { - List titles = post.all! - .toJson( - include: ["title"], onlyValues: true) - .map((e) => e[0]) - .toList(); - log("$titles"); - // update post data - currentPost.updateFields( - titleField: "This Title changed"); - }, - ), - onTap: () => context.go('/posts/$index')); + return RocketView( + model: currentPost, + // This widget will rebuild only when title of current post changed + fields: const [postTitleField], + builder: (context, state) { + return ListTile( + leading: Text(currentPost.id.toString()), + title: Text(currentPost.title!), + trailing: IconButton( + color: Colors.brown, + icon: const Icon(Icons.update), + onPressed: () { + // update post data + currentPost.updateFields( + titleField: "This Title changed"); + }, + ), + onTap: () => context.go('/posts/$index')); + }, + ); }, ), ); @@ -116,15 +116,21 @@ class Details extends StatelessWidget { @override Widget build(BuildContext context) { Post currentPost = post.all![index]; - return Scaffold( - appBar: AppBar(title: Text(currentPost.title!)), - body: Center( - child: ListTile( - leading: Text(currentPost.id.toString()), - title: Text(currentPost.title!), - subtitle: Text(currentPost.body!), - ), - ), + return RocketView( + model: currentPost, + fields: const [postTitleField, postBodyField], + builder: (context, state) { + return Scaffold( + appBar: AppBar(title: Text(currentPost.title!)), + body: Center( + child: ListTile( + leading: Text(currentPost.id.toString()), + title: Text(currentPost.title!), + subtitle: Text(currentPost.body!), + ), + ), + ); + }, ); } } diff --git a/packages/flutter_rocket/example/pubspec.lock b/packages/flutter_rocket/example/pubspec.lock deleted file mode 100644 index 29d7c24..0000000 --- a/packages/flutter_rocket/example/pubspec.lock +++ /dev/null @@ -1,481 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - ffi: - dependency: transitive - description: - name: ffi - sha256: d07d37192dbf97461359c1518788f203b0c9102cfd2c35a716b823741219542c - url: "https://pub.dev" - source: hosted - version: "2.1.5" - file: - dependency: transitive - description: - name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" - url: "https://pub.dev" - source: hosted - version: "7.0.0" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_driver: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 - url: "https://pub.dev" - source: hosted - version: "2.0.3" - flutter_rocket: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "0.0.7" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_web_plugins: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - fuchsia_remote_debug_protocol: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - go_router: - dependency: "direct main" - description: - name: go_router - sha256: e1a30a66d734f9e498b1b6522d6a75ded28242bad2359a9158df38a1c30bcf1f - url: "https://pub.dev" - source: hosted - version: "10.2.0" - http: - dependency: transitive - description: - name: http - sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f - url: "https://pub.dev" - source: hosted - version: "1.3.0" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" - url: "https://pub.dev" - source: hosted - version: "4.1.2" - integration_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" - url: "https://pub.dev" - source: hosted - version: "11.0.2" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" - url: "https://pub.dev" - source: hosted - version: "3.0.10" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - lints: - dependency: transitive - description: - name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - logging: - dependency: transitive - description: - name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 - url: "https://pub.dev" - source: hosted - version: "1.3.0" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - path_provider_linux: - dependency: transitive - description: - name: path_provider_linux - sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.dev" - source: hosted - version: "2.2.1" - path_provider_platform_interface: - dependency: transitive - description: - name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - path_provider_windows: - dependency: transitive - description: - name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 - url: "https://pub.dev" - source: hosted - version: "2.3.0" - platform: - dependency: transitive - description: - name: platform - sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" - url: "https://pub.dev" - source: hosted - version: "3.1.5" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.dev" - source: hosted - version: "2.1.8" - process: - dependency: transitive - description: - name: process - sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" - url: "https://pub.dev" - source: hosted - version: "5.0.2" - rocket_cache: - dependency: transitive - description: - path: "../../rocket_cache" - relative: true - source: path - version: "0.0.1" - rocket_client: - dependency: "direct overridden" - description: - path: "../../rocket_client" - relative: true - source: path - version: "0.0.5" - rocket_listenable: - dependency: "direct overridden" - description: - path: "../../rocket_listenable" - relative: true - source: path - version: "0.0.1" - rocket_mini_view: - dependency: "direct overridden" - description: - path: "../../rocket_mini_view" - relative: true - source: path - version: "0.0.2" - rocket_model: - dependency: "direct overridden" - description: - path: "../../rocket_model" - relative: true - source: path - version: "0.0.3" - rocket_singleton: - dependency: "direct overridden" - description: - path: "../../rocket_singleton" - relative: true - source: path - version: "0.0.4" - rocket_view: - dependency: "direct overridden" - description: - path: "../../rocket_view" - relative: true - source: path - version: "0.0.3" - shared_preferences: - dependency: transitive - description: - name: shared_preferences - sha256: "2939ae520c9024cb197fc20dee269cd8cdbf564c8b5746374ec6cacdc5169e64" - url: "https://pub.dev" - source: hosted - version: "2.5.4" - shared_preferences_android: - dependency: transitive - description: - name: shared_preferences_android - sha256: "83af5c682796c0f7719c2bbf74792d113e40ae97981b8f266fa84574573556bc" - url: "https://pub.dev" - source: hosted - version: "2.4.18" - shared_preferences_foundation: - dependency: transitive - description: - name: shared_preferences_foundation - sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" - url: "https://pub.dev" - source: hosted - version: "2.5.6" - shared_preferences_linux: - dependency: transitive - description: - name: shared_preferences_linux - sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shared_preferences_platform_interface: - dependency: transitive - description: - name: shared_preferences_platform_interface - sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shared_preferences_web: - dependency: transitive - description: - name: shared_preferences_web - sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 - url: "https://pub.dev" - source: hosted - version: "2.4.3" - shared_preferences_windows: - dependency: transitive - description: - name: shared_preferences_windows - sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" - source: hosted - version: "1.10.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" - url: "https://pub.dev" - source: hosted - version: "1.3.0" - sync_http: - dependency: transitive - description: - name: sync_http - sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" - url: "https://pub.dev" - source: hosted - version: "0.3.1" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" - url: "https://pub.dev" - source: hosted - version: "0.7.6" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b - url: "https://pub.dev" - source: hosted - version: "2.2.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b - url: "https://pub.dev" - source: hosted - version: "14.3.0" - web: - dependency: transitive - description: - name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb - url: "https://pub.dev" - source: hosted - version: "1.1.0" - webdriver: - dependency: transitive - description: - name: webdriver - sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8" - url: "https://pub.dev" - source: hosted - version: "3.0.4" - xdg_directories: - dependency: transitive - description: - name: xdg_directories - sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" - url: "https://pub.dev" - source: hosted - version: "1.1.0" -sdks: - dart: ">=3.9.0 <4.0.0" - flutter: ">=3.35.0" diff --git a/packages/flutter_rocket/pubspec.yaml b/packages/flutter_rocket/pubspec.yaml index 24e7565..738f44b 100644 --- a/packages/flutter_rocket/pubspec.yaml +++ b/packages/flutter_rocket/pubspec.yaml @@ -1,10 +1,9 @@ name: flutter_rocket description: Powerful package for state management & request. -version: 0.0.7 +version: 0.0.9 repository: https://github.com/JahezAcademy/flutter_rocket/flutter_rocket issue_tracker: https://github.com/JahezAcademy/flutter_rocket/labels/flutter_rocket homepage: https://github.com/JahezAcademy/flutter_rocket -publish_to: none environment: sdk: '>=3.0.0 <4.0.0' @@ -13,20 +12,13 @@ environment: dependencies: flutter: sdk: flutter - rocket_model: - path: ../rocket_model - rocket_listenable: - path: ../rocket_listenable - rocket_view: - path: ../rocket_view - rocket_mini_view: - path: ../rocket_mini_view - rocket_client: - path: ../rocket_client - rocket_singleton: - path: ../rocket_singleton - rocket_cache: - path: ../rocket_cache + rocket_model: ^0.0.4 + rocket_listenable: ^0.0.2 + rocket_view: ^0.0.4 + rocket_mini_view: ^0.0.3 + rocket_client: ^0.0.6 + rocket_singleton: ^0.0.4 + rocket_cache: ^0.0.2 dev_dependencies: diff --git a/packages/rocket_cache/CHANGELOG.md b/packages/rocket_cache/CHANGELOG.md new file mode 100644 index 0000000..16a7cc5 --- /dev/null +++ b/packages/rocket_cache/CHANGELOG.md @@ -0,0 +1,9 @@ +## 0.0.2 + +* Updated metadata and documentation. + +## 0.0.1 + +* Initial release of `rocket_cache`. +* Added `RocketCache` class for handling persistence. +* Integrated with `shared_preferences`. diff --git a/packages/rocket_cache/LICENSE b/packages/rocket_cache/LICENSE new file mode 100644 index 0000000..90c0dd3 --- /dev/null +++ b/packages/rocket_cache/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) 2021 Mohammed CHAHBOUN + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/packages/rocket_cache/README.md b/packages/rocket_cache/README.md new file mode 100644 index 0000000..7a13d53 --- /dev/null +++ b/packages/rocket_cache/README.md @@ -0,0 +1,30 @@ +# Rocket Cache + +A persistence and caching layer for the [Flutter Rocket](https://pub.dev/packages/flutter_rocket) package. + +## Features + +- Simple key-value persistence using `shared_preferences`. +- Automatically handles serialization for `RocketModel`. +- Support for cache duration/expiration. + +## Getting Started + +Initialize the cache storage: + +```dart +await RocketCache.init(); +``` + +## Usage + +Use it directly with `RocketClient`: + +```dart +client.request( + 'posts', + model: postModel, + cacheKey: 'all_posts', + cacheDuration: Duration(days: 1), +); +``` diff --git a/packages/rocket_cache/pubspec.yaml b/packages/rocket_cache/pubspec.yaml index fd84cdd..02ad726 100644 --- a/packages/rocket_cache/pubspec.yaml +++ b/packages/rocket_cache/pubspec.yaml @@ -1,9 +1,8 @@ name: rocket_cache description: A persistence and caching layer for the Rocket package. -version: 0.0.1 +version: 0.0.2 repository: https://github.com/JahezAcademy/flutter_rocket/tree/dev/packages/rocket_cache homepage: https://github.com/JahezAcademy/flutter_rocket -publish_to: none environment: sdk: '>=3.0.0 <4.0.0' diff --git a/packages/rocket_client/CHANGELOG.md b/packages/rocket_client/CHANGELOG.md index 7d2d10c..495a8aa 100644 --- a/packages/rocket_client/CHANGELOG.md +++ b/packages/rocket_client/CHANGELOG.md @@ -1,30 +1,30 @@ -## 0.0.1 +## 0.0.6 -* [Old changelogs](https://pub.dev/packages/flutter_rocket/changelog) +* Added support for Request and Response Interceptors. +* Integrated `rocket_cache` for offline data persistence. +* Improved error handling and response logging. -# 0.0.2 +## 0.0.5 -* Renamed `targetData` param to `target` on request `method` -* Fixed issues on `inspect` & `targetData` param of `request` -* Return `RocketModel` from `request` method instead of `dynamic` -* Added `onResponse` parameter to `RocketRequest` for handle common cases -* Added `onError` method parameter to `request` method +* Adds `requestSimulation` method for Support api integration simulation +* Fix `Request with GET/HEAD method cannot have body` bug -# 0.0.3 +## 0.0.4 -* Fixed bug on `request` method +* Support request retry -# 0.0.4 +## 0.0.3 -* Support request retry +* Fixed bug on `request` method -# 0.0.5 +## 0.0.2 -* Adds `requestSimulation` method for Support api integration simulation -* Fix `Request with GET/HEAD method cannot have body` bug +* Renamed `targetData` param to `target` on request `method` +* Fixed issues on `inspect` & `targetData` param of `request` +* Return `RocketModel` from `request` method instead of `dynamic` +* Added `onResponse` parameter to `RocketRequest` for handle common cases +* Added `onError` method parameter to `request` method -# 0.0.6 +## 0.0.1 -* Added support for Request and Response Interceptors. -* Integrated `rocket_cache` for offline data persistence. -* Improved error handling and response logging. \ No newline at end of file +* [Old changelogs](https://pub.dev/packages/flutter_rocket/changelog) \ No newline at end of file diff --git a/packages/rocket_client/example/pubspec.lock b/packages/rocket_client/example/pubspec.lock deleted file mode 100644 index 02c5a3b..0000000 --- a/packages/rocket_client/example/pubspec.lock +++ /dev/null @@ -1,400 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be - url: "https://pub.dev" - source: hosted - version: "1.0.5" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - ffi: - dependency: transitive - description: - name: ffi - sha256: d07d37192dbf97461359c1518788f203b0c9102cfd2c35a716b823741219542c - url: "https://pub.dev" - source: hosted - version: "2.1.5" - file: - dependency: transitive - description: - name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 - url: "https://pub.dev" - source: hosted - version: "7.0.1" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_web_plugins: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - http: - dependency: transitive - description: - name: http - sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" - url: "https://pub.dev" - source: hosted - version: "1.6.0" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" - url: "https://pub.dev" - source: hosted - version: "11.0.2" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" - url: "https://pub.dev" - source: hosted - version: "3.0.10" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - lints: - dependency: transitive - description: - name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - path_provider_linux: - dependency: transitive - description: - name: path_provider_linux - sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.dev" - source: hosted - version: "2.2.1" - path_provider_platform_interface: - dependency: transitive - description: - name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - path_provider_windows: - dependency: transitive - description: - name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 - url: "https://pub.dev" - source: hosted - version: "2.3.0" - platform: - dependency: transitive - description: - name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" - url: "https://pub.dev" - source: hosted - version: "3.1.6" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.dev" - source: hosted - version: "2.1.8" - rocket_cache: - dependency: transitive - description: - path: "../../rocket_cache" - relative: true - source: path - version: "0.0.1" - rocket_client: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "0.0.5" - rocket_listenable: - dependency: transitive - description: - name: rocket_listenable - sha256: "908014caa9bde6d8b9910eee50001f52a9db6f575ae86957289ff81d444b14f5" - url: "https://pub.dev" - source: hosted - version: "0.0.1" - rocket_model: - dependency: "direct main" - description: - name: rocket_model - sha256: c515a9788aaff0967cd2beb0c5f40a5fc9f88ad7fd69f78baccc27434316280a - url: "https://pub.dev" - source: hosted - version: "0.0.3" - shared_preferences: - dependency: transitive - description: - name: shared_preferences - sha256: "2939ae520c9024cb197fc20dee269cd8cdbf564c8b5746374ec6cacdc5169e64" - url: "https://pub.dev" - source: hosted - version: "2.5.4" - shared_preferences_android: - dependency: transitive - description: - name: shared_preferences_android - sha256: "83af5c682796c0f7719c2bbf74792d113e40ae97981b8f266fa84574573556bc" - url: "https://pub.dev" - source: hosted - version: "2.4.18" - shared_preferences_foundation: - dependency: transitive - description: - name: shared_preferences_foundation - sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" - url: "https://pub.dev" - source: hosted - version: "2.5.6" - shared_preferences_linux: - dependency: transitive - description: - name: shared_preferences_linux - sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shared_preferences_platform_interface: - dependency: transitive - description: - name: shared_preferences_platform_interface - sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shared_preferences_web: - dependency: transitive - description: - name: shared_preferences_web - sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 - url: "https://pub.dev" - source: hosted - version: "2.4.3" - shared_preferences_windows: - dependency: transitive - description: - name: shared_preferences_windows - sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_span: - dependency: transitive - description: - name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" - source: hosted - version: "1.9.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" - url: "https://pub.dev" - source: hosted - version: "0.7.6" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" - source: hosted - version: "1.3.2" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b - url: "https://pub.dev" - source: hosted - version: "2.2.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" - url: "https://pub.dev" - source: hosted - version: "15.0.2" - web: - dependency: transitive - description: - name: web - sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - xdg_directories: - dependency: transitive - description: - name: xdg_directories - sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" - url: "https://pub.dev" - source: hosted - version: "1.1.0" -sdks: - dart: ">=3.9.0 <4.0.0" - flutter: ">=3.35.0" diff --git a/packages/rocket_client/pubspec.yaml b/packages/rocket_client/pubspec.yaml index e2b85ae..7a38eff 100644 --- a/packages/rocket_client/pubspec.yaml +++ b/packages/rocket_client/pubspec.yaml @@ -4,7 +4,6 @@ version: 0.0.6 repository: https://github.com/JahezAcademy/flutter_rocket/tree/dev/packages/rocket_client issue_tracker: https://github.com/JahezAcademy/flutter_rocket/labels/rocket_client homepage: https://github.com/JahezAcademy/flutter_rocket -publish_to: none environment: sdk: '>=3.0.0 <4.0.0' @@ -14,10 +13,8 @@ dependencies: flutter: sdk: flutter http: ^1.2.1 - rocket_model: - path: ../rocket_model - rocket_cache: - path: ../rocket_cache + rocket_model: ^0.0.4 + rocket_cache: ^0.0.2 dev_dependencies: flutter_test: diff --git a/packages/rocket_listenable/CHANGELOG.md b/packages/rocket_listenable/CHANGELOG.md index d4986ec..c6759b8 100644 --- a/packages/rocket_listenable/CHANGELOG.md +++ b/packages/rocket_listenable/CHANGELOG.md @@ -1,9 +1,8 @@ -## 0.0.1 - -* [CHANGELOG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/packages/flutter_rocket/CHANGELOG.md) - ## 0.0.2 * Added support for selective listeners via string keys. * Optimized `callListeners` and `removeListeners` performance. +## 0.0.1 + +* [CHANGELOG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/packages/flutter_rocket/CHANGELOG.md) diff --git a/packages/rocket_listenable/example/pubspec.lock b/packages/rocket_listenable/example/pubspec.lock deleted file mode 100644 index 4968b46..0000000 --- a/packages/rocket_listenable/example/pubspec.lock +++ /dev/null @@ -1,220 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be - url: "https://pub.dev" - source: hosted - version: "1.0.5" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" - url: "https://pub.dev" - source: hosted - version: "11.0.2" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" - url: "https://pub.dev" - source: hosted - version: "3.0.10" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - lints: - dependency: transitive - description: - name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - rocket_listenable: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "0.0.1" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_span: - dependency: transitive - description: - name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" - source: hosted - version: "1.9.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" - url: "https://pub.dev" - source: hosted - version: "0.7.6" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b - url: "https://pub.dev" - source: hosted - version: "2.2.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" - url: "https://pub.dev" - source: hosted - version: "15.0.2" -sdks: - dart: ">=3.8.0-0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/rocket_mini_view/CHANGELOG.md b/packages/rocket_mini_view/CHANGELOG.md index 87dea9c..dd9522a 100644 --- a/packages/rocket_mini_view/CHANGELOG.md +++ b/packages/rocket_mini_view/CHANGELOG.md @@ -1,7 +1,11 @@ -## 0.0.1 +## 0.0.3 -* [CHANGELOG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/packages/flutter_rocket/CHANGELOG.md) +* Updated `rocket_listenable` dependency. ## 0.0.2 -* Fix nullable rocket value issue \ No newline at end of file +* Fix nullable rocket value issue + +## 0.0.1 + +* [CHANGELOG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/packages/flutter_rocket/CHANGELOG.md) \ No newline at end of file diff --git a/packages/rocket_mini_view/example/pubspec.lock b/packages/rocket_mini_view/example/pubspec.lock deleted file mode 100644 index c7dc6ac..0000000 --- a/packages/rocket_mini_view/example/pubspec.lock +++ /dev/null @@ -1,227 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be - url: "https://pub.dev" - source: hosted - version: "1.0.5" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" - url: "https://pub.dev" - source: hosted - version: "11.0.2" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" - url: "https://pub.dev" - source: hosted - version: "3.0.10" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - lints: - dependency: transitive - description: - name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - rocket_listenable: - dependency: transitive - description: - path: "../../rocket_listenable" - relative: true - source: path - version: "0.0.1" - rocket_mini_view: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "0.0.2" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_span: - dependency: transitive - description: - name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" - source: hosted - version: "1.9.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" - url: "https://pub.dev" - source: hosted - version: "0.7.6" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b - url: "https://pub.dev" - source: hosted - version: "2.2.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" - url: "https://pub.dev" - source: hosted - version: "15.0.2" -sdks: - dart: ">=3.8.0-0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/rocket_mini_view/pubspec.yaml b/packages/rocket_mini_view/pubspec.yaml index 82be4ce..25f7fe1 100644 --- a/packages/rocket_mini_view/pubspec.yaml +++ b/packages/rocket_mini_view/pubspec.yaml @@ -1,10 +1,9 @@ name: rocket_mini_view description: Mini view for RocketValue. -version: 0.0.2 +version: 0.0.3 repository: https://github.com/JahezAcademy/flutter_rocket/tree/dev/packages/rocket_mini_view issue_tracker: https://github.com/JahezAcademy/flutter_rocket/labels/rocket_mini_view homepage: https://github.com/JahezAcademy/flutter_rocket -publish_to: none environment: sdk: '>=3.0.0 <4.0.0' @@ -13,8 +12,7 @@ environment: dependencies: flutter: sdk: flutter - rocket_listenable: - path: ../rocket_listenable + rocket_listenable: ^0.0.2 dev_dependencies: flutter_test: diff --git a/packages/rocket_model/CHANGELOG.md b/packages/rocket_model/CHANGELOG.md index 492477e..9d38166 100644 --- a/packages/rocket_model/CHANGELOG.md +++ b/packages/rocket_model/CHANGELOG.md @@ -1,16 +1,16 @@ -## 0.0.1 - -[CHANGELOG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/packages/flutter_rocket/CHANGELOG.md) - -## 0.0.2 +## 0.0.4 -* Added `apiResponse` & `statusCode` fields +* Added `fields` support to `rebuildWidget` for targeted UI updates. +* Optimized field notification logic. ## 0.0.3 * Updated `RocketException` object fields -## 0.0.4 +## 0.0.2 -* Added `fields` support to `rebuildWidget` for targeted UI updates. -* Optimized field notification logic. \ No newline at end of file +* Added `apiResponse` & `statusCode` fields + +## 0.0.1 + +[CHANGELOG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/packages/flutter_rocket/CHANGELOG.md) \ No newline at end of file diff --git a/packages/rocket_model/example/pubspec.lock b/packages/rocket_model/example/pubspec.lock deleted file mode 100644 index df72a88..0000000 --- a/packages/rocket_model/example/pubspec.lock +++ /dev/null @@ -1,228 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be - url: "https://pub.dev" - source: hosted - version: "1.0.5" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" - url: "https://pub.dev" - source: hosted - version: "11.0.2" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" - url: "https://pub.dev" - source: hosted - version: "3.0.10" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - lints: - dependency: transitive - description: - name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - rocket_listenable: - dependency: transitive - description: - name: rocket_listenable - sha256: "908014caa9bde6d8b9910eee50001f52a9db6f575ae86957289ff81d444b14f5" - url: "https://pub.dev" - source: hosted - version: "0.0.1" - rocket_model: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "0.0.3" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_span: - dependency: transitive - description: - name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" - source: hosted - version: "1.9.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" - url: "https://pub.dev" - source: hosted - version: "0.7.6" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b - url: "https://pub.dev" - source: hosted - version: "2.2.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" - url: "https://pub.dev" - source: hosted - version: "15.0.2" -sdks: - dart: ">=3.8.0-0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/rocket_model/pubspec.yaml b/packages/rocket_model/pubspec.yaml index 8ae4d01..e0bc780 100644 --- a/packages/rocket_model/pubspec.yaml +++ b/packages/rocket_model/pubspec.yaml @@ -4,7 +4,6 @@ version: 0.0.4 repository: https://github.com/JahezAcademy/flutter_rocket/tree/dev/packages/rocket_model issue_tracker: https://github.com/JahezAcademy/flutter_rocket/labels/rocket_model homepage: https://github.com/JahezAcademy/flutter_rocket -publish_to: none environment: sdk: '>=3.0.0 <4.0.0' @@ -13,8 +12,7 @@ environment: dependencies: flutter: sdk: flutter - rocket_listenable: - path: ../rocket_listenable + rocket_listenable: ^0.0.2 dev_dependencies: flutter_test: diff --git a/packages/rocket_singleton/CHANGELOG.md b/packages/rocket_singleton/CHANGELOG.md index 0ee5bc9..fe41a56 100644 --- a/packages/rocket_singleton/CHANGELOG.md +++ b/packages/rocket_singleton/CHANGELOG.md @@ -1,14 +1,18 @@ -[old changelogs](https://github.com/JahezAcademy/flutter_rocket/blob/dev/CHANGELOG.md) +## 0.0.4 -## 0.0.1 +* Updated dependencies and metadata. -* [CHANGELOG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/packages/flutter_rocket/CHANGELOG.md) -* Added `Save extension` to dynamic for rocket.add +## 0.0.3 + +* Fixed get method issue ## 0.0.2 * Fixed haskey method issue -## 0.0.3 +## 0.0.1 -* Fixed get method issue +* [CHANGELOG](https://github.com/JahezAcademy/flutter_rocket/blob/dev/packages/flutter_rocket/CHANGELOG.md) +* Added `Save extension` to dynamic for rocket.add + +[old changelogs](https://github.com/JahezAcademy/flutter_rocket/blob/dev/CHANGELOG.md) diff --git a/packages/rocket_singleton/example/pubspec.lock b/packages/rocket_singleton/example/pubspec.lock deleted file mode 100644 index b064613..0000000 --- a/packages/rocket_singleton/example/pubspec.lock +++ /dev/null @@ -1,220 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be - url: "https://pub.dev" - source: hosted - version: "1.0.5" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" - url: "https://pub.dev" - source: hosted - version: "11.0.2" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" - url: "https://pub.dev" - source: hosted - version: "3.0.10" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - lints: - dependency: transitive - description: - name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - rocket_singleton: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "0.0.4" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_span: - dependency: transitive - description: - name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" - source: hosted - version: "1.9.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" - url: "https://pub.dev" - source: hosted - version: "0.7.6" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b - url: "https://pub.dev" - source: hosted - version: "2.2.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" - url: "https://pub.dev" - source: hosted - version: "15.0.2" -sdks: - dart: ">=3.8.0-0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/rocket_view/CHANGELOG.md b/packages/rocket_view/CHANGELOG.md index d42df27..4e9a055 100644 --- a/packages/rocket_view/CHANGELOG.md +++ b/packages/rocket_view/CHANGELOG.md @@ -1,18 +1,18 @@ -## 0.0.1 - -* [Old changelogs](https://pub.dev/packages/flutter_rocket/changelog) - -## 0.0.2 +## 0.0.4 -* Changed `loader` widget arg to `onLoading` builder -* Improved states onLoading & onError +* Added `fields` parameter to `RocketView` for selective rebuilds. +* Improved performance by filtering rebuilds based on notified fields. ## 0.0.3 * Renamed `call` to `fetch` RocketView Parameter * Improved invoke `fetch` method -## 0.0.4 +## 0.0.2 -* Added `fields` parameter to `RocketView` for selective rebuilds. -* Improved performance by filtering rebuilds based on notified fields. \ No newline at end of file +* Changed `loader` widget arg to `onLoading` builder +* Improved states onLoading & onError + +## 0.0.1 + +* [Old changelogs](https://pub.dev/packages/flutter_rocket/changelog) \ No newline at end of file diff --git a/packages/rocket_view/example/pubspec.lock b/packages/rocket_view/example/pubspec.lock deleted file mode 100644 index a2b1f0d..0000000 --- a/packages/rocket_view/example/pubspec.lock +++ /dev/null @@ -1,234 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 - url: "https://pub.dev" - source: hosted - version: "2.0.3" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" - url: "https://pub.dev" - source: hosted - version: "11.0.2" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" - url: "https://pub.dev" - source: hosted - version: "3.0.10" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - lints: - dependency: transitive - description: - name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - rocket_listenable: - dependency: transitive - description: - path: "../../rocket_listenable" - relative: true - source: path - version: "0.0.1" - rocket_model: - dependency: transitive - description: - path: "../../rocket_model" - relative: true - source: path - version: "0.0.3" - rocket_view: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "0.0.3" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" - source: hosted - version: "1.10.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" - url: "https://pub.dev" - source: hosted - version: "1.3.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" - url: "https://pub.dev" - source: hosted - version: "0.7.6" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b - url: "https://pub.dev" - source: hosted - version: "2.2.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b - url: "https://pub.dev" - source: hosted - version: "14.3.0" -sdks: - dart: ">=3.8.0-0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/rocket_view/pubspec.yaml b/packages/rocket_view/pubspec.yaml index c9f36f8..2225946 100644 --- a/packages/rocket_view/pubspec.yaml +++ b/packages/rocket_view/pubspec.yaml @@ -4,7 +4,6 @@ version: 0.0.4 repository: https://github.com/JahezAcademy/flutter_rocket/tree/dev/packages/rocket_view issue_tracker: https://github.com/JahezAcademy/flutter_rocket/labels/rocket_view homepage: https://github.com/JahezAcademy/flutter_rocket -publish_to: none environment: sdk: '>=3.0.0 <4.0.0' @@ -13,10 +12,8 @@ environment: dependencies: flutter: sdk: flutter - rocket_model: - path: ../rocket_model - rocket_listenable: - path: ../rocket_listenable + rocket_model: ^0.0.4 + rocket_listenable: ^0.0.2 dev_dependencies: flutter_test: diff --git a/rocket_cli/CHANGELOG.md b/rocket_cli/CHANGELOG.md index effe43c..d2a0389 100644 --- a/rocket_cli/CHANGELOG.md +++ b/rocket_cli/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.0 + +- Added support for selective fields in `updateFields` method to improve performance with selective rebuilds. + ## 1.0.0 - Initial version. diff --git a/rocket_cli/lib/src/model_generator/models/generator.dart b/rocket_cli/lib/src/model_generator/models/generator.dart index fd61643..ebbcea3 100644 --- a/rocket_cli/lib/src/model_generator/models/generator.dart +++ b/rocket_cli/lib/src/model_generator/models/generator.dart @@ -71,7 +71,7 @@ class Generator { 'const String ${className.toLowerCase()}${key.camel.firstUpper}Field = "$key";'; final String updateFieldParamLine = "$fieldType? ${key.camel}Field,"; final String updateFieldBodyLine = - "${key.camel} = ${key.camel}Field ?? ${key.camel};"; + "if (${key.camel}Field != null) { ${key.camel} = ${key.camel}Field; fields.add($fieldKeyMap); }"; bool isPrimitive = _isPrimitive(value); diff --git a/rocket_cli/lib/src/model_generator/models/utils/template.dart b/rocket_cli/lib/src/model_generator/models/utils/template.dart index 1acac73..721fc0b 100644 --- a/rocket_cli/lib/src/model_generator/models/utils/template.dart +++ b/rocket_cli/lib/src/model_generator/models/utils/template.dart @@ -19,8 +19,9 @@ class -name- extends RocketModel<-name-> { void updateFields({ -updateFieldsParams- }) { - -updateFieldsBody- - rebuildWidget(fromUpdate: true); + List fields = []; + -updateFieldsBody- + rebuildWidget(fromUpdate: true, fields: fields.isEmpty ? null : fields); } @override diff --git a/rocket_cli/pubspec.lock b/rocket_cli/pubspec.lock deleted file mode 100644 index cc2124c..0000000 --- a/rocket_cli/pubspec.lock +++ /dev/null @@ -1,381 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: "405666cd3cf0ee0a48d21ec67e65406aad2c726d9fa58840d3375e7bdcd32a07" - url: "https://pub.dev" - source: hosted - version: "60.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: "1952250bd005bacb895a01bf1b4dc00e3ba1c526cf47dca54dfe24979c65f5b3" - url: "https://pub.dev" - source: hosted - version: "5.12.0" - args: - dependency: "direct main" - description: - name: args - sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 - url: "https://pub.dev" - source: hosted - version: "2.7.0" - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - collection: - dependency: transitive - description: - name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 - url: "https://pub.dev" - source: hosted - version: "1.17.2" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - coverage: - dependency: transitive - description: - name: coverage - sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" - url: "https://pub.dev" - source: hosted - version: "1.6.3" - crypto: - dependency: transitive - description: - name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab - url: "https://pub.dev" - source: hosted - version: "3.0.3" - dart_style: - dependency: "direct main" - description: - name: dart_style - sha256: f4f1f73ab3fd2afcbcca165ee601fe980d966af6a21b5970c6c9376955c528ad - url: "https://pub.dev" - source: hosted - version: "2.3.1" - file: - dependency: transitive - description: - name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" - url: "https://pub.dev" - source: hosted - version: "6.1.4" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" - url: "https://pub.dev" - source: hosted - version: "3.2.0" - glob: - dependency: transitive - description: - name: glob - sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.dev" - source: hosted - version: "3.2.1" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - io: - dependency: transitive - description: - name: io - sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" - lints: - dependency: "direct dev" - description: - name: lints - sha256: "6b0206b0bf4f04961fc5438198ccb3a885685cd67d4d4a32cc20ad7f8adbe015" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - logging: - dependency: transitive - description: - name: logging - sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" - url: "https://pub.dev" - source: hosted - version: "0.12.15" - meta: - dependency: transitive - description: - name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - mime: - dependency: transitive - description: - name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e - url: "https://pub.dev" - source: hosted - version: "1.0.4" - node_preamble: - dependency: transitive - description: - name: node_preamble - sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - package_config: - dependency: transitive - description: - name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - path: - dependency: transitive - description: - name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" - url: "https://pub.dev" - source: hosted - version: "1.8.3" - pool: - dependency: transitive - description: - name: pool - sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" - source: hosted - version: "1.5.1" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - shelf: - dependency: transitive - description: - name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 - url: "https://pub.dev" - source: hosted - version: "1.4.1" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - shelf_static: - dependency: transitive - description: - name: shelf_static - sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e - url: "https://pub.dev" - source: hosted - version: "1.1.2" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - source_maps: - dependency: transitive - description: - name: source_maps - sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" - url: "https://pub.dev" - source: hosted - version: "0.10.12" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" - source: hosted - version: "1.10.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 - url: "https://pub.dev" - source: hosted - version: "1.11.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test: - dependency: "direct dev" - description: - name: test - sha256: "4f92f103ef63b1bbac6f4bd1930624fca81b2574464482512c4f0896319be575" - url: "https://pub.dev" - source: hosted - version: "1.24.2" - test_api: - dependency: transitive - description: - name: test_api - sha256: daadc9baabec998b062c9091525aa95786508b1c48e9c30f1f891b8bf6ff2e64 - url: "https://pub.dev" - source: hosted - version: "0.5.2" - test_core: - dependency: transitive - description: - name: test_core - sha256: "3642b184882f79e76ca57a9230fb971e494c3c1fd09c21ae3083ce891bcc0aa1" - url: "https://pub.dev" - source: hosted - version: "0.5.2" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" - source: hosted - version: "1.3.2" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: f3743ca475e0c9ef71df4ba15eb2d7684eecd5c8ba20a462462e4e8b561b2e11 - url: "https://pub.dev" - source: hosted - version: "11.6.0" - watcher: - dependency: transitive - description: - name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b - url: "https://pub.dev" - source: hosted - version: "2.4.0" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - yaml: - dependency: transitive - description: - name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" - url: "https://pub.dev" - source: hosted - version: "3.1.2" -sdks: - dart: ">=3.3.0 <4.0.0" diff --git a/rocket_cli/pubspec.yaml b/rocket_cli/pubspec.yaml index b9d2f7f..36243a0 100644 --- a/rocket_cli/pubspec.yaml +++ b/rocket_cli/pubspec.yaml @@ -1,6 +1,6 @@ name: rocket_cli description: A command-line tool for generating RocketModel classes from JSON for the flutter_rocket package. -version: 1.0.0 +version: 1.1.0 repository: https://github.com/JahezAcademy/flutter_rocket/tree/dev/rocket_cli homepage: https://github.com/JahezAcademy/flutter_rocket diff --git a/rocket_cli/test/rocket_cli_test.dart b/rocket_cli/test/rocket_cli_test.dart index 051db73..1fd728d 100644 --- a/rocket_cli/test/rocket_cli_test.dart +++ b/rocket_cli/test/rocket_cli_test.dart @@ -1,6 +1,5 @@ import 'package:test/test.dart'; import 'package:rocket_cli/rocket_cli.dart'; -import 'package:rocket_cli/src/model_generator/models/utils/extensions.dart'; void main() { group('EString Extension Tests', () { @@ -150,5 +149,30 @@ void main() { final result = controller.models.first.result; expect(result, contains('List? items;')); }); + + test('Generates updateFields with selective rebuild logic', () async { + const jsonStr = '{"title": "Hello", "body": "World"}'; + await generator.generate(jsonStr, 'Post', controller); + + final result = controller.models.first.result; + + // Check for fields list initialization + expect(result, contains('List fields = [];')); + + // Check for selective field updates + expect(result, contains('if (titleField != null) {')); + expect(result, contains('title = titleField;')); + expect(result, contains('fields.add(postTitleField);')); + + expect(result, contains('if (bodyField != null) {')); + expect(result, contains('body = bodyField;')); + expect(result, contains('fields.add(postBodyField);')); + + // Check for rebuildWidget call with fields + expect( + result, + contains( + 'rebuildWidget(fromUpdate: true, fields: fields.isEmpty ? null : fields);')); + }); }); }