Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rxdart_flutter #759

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/flutter/github_search/lib/search_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'search_state.dart';

class SearchBloc {
final Sink<String> onTextChanged;
final Stream<SearchState> state;
final ValueStream<SearchState> state;

factory SearchBloc(GithubApi api) {
final onTextChanged = PublishSubject<String>();
Expand All @@ -23,7 +23,9 @@ class SearchBloc {
// to the View.
.switchMap<SearchState>((String term) => _search(term, api))
// The initial state to deliver to the screen.
.startWith(SearchNoTerm());
.startWith(SearchNoTerm())
.publishValueSeeded(SearchNoTerm())
..connect();

return SearchBloc._(onTextChanged, state);
}
Expand Down
7 changes: 3 additions & 4 deletions examples/flutter/github_search/lib/search_widget.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 'empty_result_widget.dart';
import 'github_api.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: SearchNoTerm(),
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
7 changes: 7 additions & 0 deletions examples/flutter/github_search/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ packages:
relative: true
source: path
version: "0.28.0-dev.2"
rxdart_flutter:
dependency: "direct main"
description:
path: "../../../packages/rxdart_flutter"
relative: true
source: path
version: "0.0.1"
shelf:
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

Expand Down
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
Loading