Skip to content

Commit

Permalink
feat(rxdart_flutter): add rxdart_flutter package (#759)
Browse files Browse the repository at this point in the history
This pull request includes multiple changes to the project, primarily focusing on updating workflows, enhancing the `github_search` example, and adding a new `rxdart_flutter` package. Below is a summary of the most important changes:

### Workflow Updates:
* Updated the `flutter-action` version to `v2.18.0` in `.github/workflows/flutter-example.yml` and `.github/workflows/rxdart-test.yml`. [[1]](diffhunk://#diff-46868a89bfc8745a14de252e4dd1e820aa24bf0e7b3b8d036541c4bf378bf27bL25-R25) [[2]](diffhunk://#diff-157a6170ab30a8278f85c37b4006d21588c1aa21ce44f5131085351215944156L21-R56)
* Modified the matrix strategy in `.github/workflows/rxdart-test.yml` to use different Flutter versions and adjusted the setup steps accordingly. [[1]](diffhunk://#diff-157a6170ab30a8278f85c37b4006d21588c1aa21ce44f5131085351215944156L21-R56) [[2]](diffhunk://#diff-157a6170ab30a8278f85c37b4006d21588c1aa21ce44f5131085351215944156L55-R66)

### `github_search` Example Enhancements:
* Added `rxdart_flutter` dependency in `pubspec.yaml` and updated `search_screen.dart` to use `ValueStreamBuilder` instead of `StreamBuilder`. [[1]](diffhunk://#diff-7c0b969291e6582b5f0eddbf7c45af79bc6c63994af819fee9f334c00ba7eb55R14-R15) [[2]](diffhunk://#diff-cf0d0844210ed730cd645a6844a593cae2e9b4633f4b77b5d12a8df9f2ed96e9R2) [[3]](diffhunk://#diff-cf0d0844210ed730cd645a6844a593cae2e9b4633f4b77b5d12a8df9f2ed96e9L47-R50)

### New `rxdart_flutter` Package:
* Created a new package `rxdart_flutter` with initial setup files including `pubspec.yaml`, `CHANGELOG.md`, `LICENSE`, and `README.md`. [[1]](diffhunk://#diff-81910676c31299677f758bd0e24347356bdb0cc7e1dbc66982634e7d8809a01bR1-R55) [[2]](diffhunk://#diff-a4faf911bf12f76cfe3bca89108da18e42928856beac84021a4beb8e603e1f3aR1-R3) [[3]](diffhunk://#diff-b3f32bdb166212812679b58e14b6ff7254893f3a6dc6977983dbfdf7ece31c6dR1) [[4]](diffhunk://#diff-60d00e48ea72ead70cb1ac040d441fe586073187cec53d54a5a93c02793047c4R1-R39)
* Added a `.gitignore` file to the `rxdart_flutter` package to exclude various files and directories.
* Included `analysis_options.yaml` for linting rules and `rxdart_flutter.dart` to export the `ValueStreamBuilder` implementation. [[1]](diffhunk://#diff-53efe4340f2359fbf71e72ff03322034994eb982634b83e313f86a94528e03c9R1-R9) [[2]](diffhunk://#diff-30064bd77cba22a69e13f66825cb0c63aa681ec603169a9a3743305cad37fa77R1-R3)
* Implemented `ValueStreamBuilder` in `src/value_stream_builder.dart` to provide a Flutter widget for building UI based on `ValueStream`.
  • Loading branch information
hoc081098 authored Jan 25, 2025
1 parent 81b909f commit e6210a5
Show file tree
Hide file tree
Showing 17 changed files with 455 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flutter-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
distribution: 'zulu'
java-version: '17'

- uses: subosito/flutter-action@v2.4.0
- uses: subosito/flutter-action@v2.18.0
with:
channel: 'stable'

Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/rxdart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,42 @@ jobs:

strategy:
matrix:
sdk: [ beta, stable, 2.17.0, 2.15.0, 2.12.0 ]
# sdk: [ beta, stable, 2.17.0, 2.15.0, 2.12.0 ]
flutter: [ beta, stable, 3.0.0, 2.8.0, 2.0.1 ]

steps:
- uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/[email protected]
- name: Setup Stable/Beta Flutter/Dart
if: ${{ matrix.flutter == 'stable' || matrix.flutter == 'beta' }}
uses: subosito/[email protected]
with:
sdk: ${{ matrix.sdk }}
channel: ${{ matrix.flutter }}

- name: Setup Older Flutter/Dart
if: ${{ matrix.flutter != 'stable' && matrix.flutter != 'beta' }}
uses: subosito/[email protected]
with:
flutter-version: ${{ matrix.flutter }}

- name: Install melos
run: dart pub global activate melos

- name: Print Dart version
- name: Print Dart SDK version
run: dart --version

- name: Print Flutter SDK version
run: flutter --version

- name: Install dependencies
run: melos run pub-get-no-private

- name: Analyze
if: ${{ matrix.sdk == 'stable' }}
if: ${{ matrix.flutter == 'stable' }}
run: melos run analyze-no-private

- name: Format code
if: ${{ matrix.sdk == 'stable' }}
if: ${{ matrix.flutter == 'stable' }}
run: melos run format-no-private

- name: Active coverage
Expand All @@ -52,4 +63,4 @@ jobs:
run: melos run test-rxdart

- uses: codecov/[email protected]
if: ${{ matrix.sdk == 'stable' }}
if: ${{ matrix.flutter == 'stable' }}
2 changes: 1 addition & 1 deletion examples/fibonacci/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ packages:
path: "../../packages/rxdart"
relative: true
source: path
version: "0.28.0-dev.2"
version: "0.28.0"
sdks:
dart: ">=3.1.0 <4.0.0"
7 changes: 3 additions & 4 deletions examples/flutter/github_search/lib/search_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:rxdart_flutter/rxdart_flutter.dart';

import 'api/github_api.dart';
import 'bloc/search_bloc.dart';
Expand Down Expand Up @@ -44,11 +45,9 @@ class SearchScreenState extends State<SearchScreen> {

@override
Widget build(BuildContext context) {
return StreamBuilder<SearchState>(
return ValueStreamBuilder<SearchState>(
stream: bloc.state,
initialData: bloc.state.value,
builder: (BuildContext context, AsyncSnapshot<SearchState> snapshot) {
final state = snapshot.requireData;
builder: (context, state) {
return Scaffold(
appBar: AppBar(
title: const Text('RxDart Github Search'),
Expand Down
53 changes: 30 additions & 23 deletions examples/flutter/github_search/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -319,18 +319,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
version: "10.0.7"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
version: "3.0.8"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -367,18 +367,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
version: "1.12.0"
version: "1.15.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -458,6 +458,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.0"
rxdart_flutter:
dependency: "direct main"
description:
path: "../../../packages/rxdart_flutter"
relative: true
source: path
version: "0.0.1"
shelf:
dependency: transitive
description:
Expand Down Expand Up @@ -494,7 +501,7 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
source_gen:
dependency: transitive
description:
Expand Down Expand Up @@ -531,10 +538,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
version: "1.12.0"
stream_channel:
dependency: transitive
description:
Expand All @@ -555,10 +562,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
term_glyph:
dependency: transitive
description:
Expand All @@ -571,26 +578,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073"
sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f"
url: "https://pub.dev"
source: hosted
version: "1.25.2"
version: "1.25.8"
test_api:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
version: "0.7.3"
test_core:
dependency: transitive
description:
name: test_core
sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4"
sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.5"
timing:
dependency: transitive
description:
Expand Down Expand Up @@ -619,10 +626,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
url: "https://pub.dev"
source: hosted
version: "14.2.1"
version: "14.3.0"
watcher:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions examples/flutter/github_search/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ dependencies:
sdk: flutter
rxdart:
path: ../../../packages/rxdart
rxdart_flutter:
path: ../../../packages/rxdart_flutter
http: ^0.13.3
flutter_spinkit: ^5.1.0
rxdart_ext: ^0.3.0
Expand Down
10 changes: 5 additions & 5 deletions examples/web/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ packages:
dependency: transitive
description:
name: build_modules
sha256: "9987d67a29081872e730468295fc565e9a2b377ca3673337c1d4e41d57c6cd7c"
sha256: "0327cb2a9eefba197b63f71872c38bafe4c63b331797a43618d6c270516a6447"
url: "https://pub.dev"
source: hosted
version: "5.0.8"
version: "5.0.11"
build_resolvers:
dependency: transitive
description:
Expand Down Expand Up @@ -117,10 +117,10 @@ packages:
dependency: "direct dev"
description:
name: build_web_compilers
sha256: "9071a94aa67787cebdd9e76837c9d2af61fb5242db541244f6a0b6249afafb46"
sha256: "01cfac85e835d9fe8e87928958586ddbd477d98cfac5af2442cb2df6bbb42dff"
url: "https://pub.dev"
source: hosted
version: "4.0.10"
version: "4.1.1"
built_collection:
dependency: transitive
description:
Expand Down Expand Up @@ -489,4 +489,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.4.0 <3.6.0"
dart: ">=3.6.0 <3.8.0-z"
30 changes: 30 additions & 0 deletions packages/rxdart_flutter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
10 changes: 10 additions & 0 deletions packages/rxdart_flutter/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "2f708eb8396e362e280fac22cf171c2cb467343c"
channel: "stable"

project_type: package
3 changes: 3 additions & 0 deletions packages/rxdart_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions packages/rxdart_flutter/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
39 changes: 39 additions & 0 deletions packages/rxdart_flutter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.

## Features

TODO: List what your package can do. Maybe include images, gifs, or videos.

## Getting started

TODO: List prerequisites and provide or point to information on how to
start using the package.

## Usage

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.

```dart
const like = 'sample';
```

## Additional information

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
9 changes: 9 additions & 0 deletions packages/rxdart_flutter/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include: package:flutter_lints/flutter.yaml
linter:
rules:
- prefer_final_locals
- prefer_relative_imports
- always_declare_return_types # https://github.com/dart-lang/lints#migrating-from-packagepedantic
- prefer_single_quotes # https://github.com/dart-lang/lints#migrating-from-packagepedantic
- unawaited_futures # https://github.com/dart-lang/lints#migrating-from-packagepedantic
- unsafe_html # https://github.com/dart-lang/lints#migrating-from-packagepedantic
3 changes: 3 additions & 0 deletions packages/rxdart_flutter/lib/rxdart_flutter.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library rxdart_flutter;

export 'src/value_stream_builder.dart';
Loading

0 comments on commit e6210a5

Please sign in to comment.