Skip to content

Commit 24007f0

Browse files
committed
update dependencies
1 parent 778a134 commit 24007f0

10 files changed

+327
-139
lines changed

analysis_options.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
include: package:pedantic/analysis_options.1.11.0.yaml
1+
include: package:flutter_lints/flutter.yaml
2+
analyzer:
3+
language:
4+
strict-casts: true
5+
strict-raw-types: true
26
linter:
37
rules:
8+
- public_member_api_docs
49
- prefer_final_locals
510
- prefer_relative_imports
6-
- public_member_api_docs
11+
# https://github.com/dart-lang/lints#migrating-from-packagepedantic
12+
- always_declare_return_types
13+
- prefer_single_quotes
14+
- unawaited_futures
15+
- unsafe_html

example/analysis_options.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
include: package:pedantic/analysis_options.1.11.0.yaml
2-
linter:
3-
rules:
4-
- prefer_final_locals
5-
- prefer_relative_imports
1+
include: package:flutter_lints/flutter.yaml

example/lib/main.dart

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import 'dart:async';
22

33
import 'package:flutter/material.dart';
4+
import 'package:flutter_bloc_pattern/flutter_bloc_pattern.dart';
5+
import 'package:flutter_disposebag/flutter_disposebag.dart';
46
import 'package:listenable_stream/listenable_stream.dart';
5-
import 'package:rxdart/rxdart.dart';
7+
import 'package:rxdart_ext/state_stream.dart';
68

79
void main() => runApp(MyApp());
810

@@ -47,27 +49,28 @@ class MainPage extends StatefulWidget {
4749
_MainPageState createState() => _MainPageState();
4850
}
4951

50-
class _MainPageState extends State<MainPage> {
52+
class _MainPageState extends State<MainPage> with DisposeBagMixin {
5153
final controller = TextEditingController();
52-
late final StreamSubscription<String> subscription;
54+
late final StateStream<String> stateStream;
5355

5456
@override
5557
void initState() {
5658
super.initState();
57-
subscription = controller
59+
60+
stateStream = controller
5861
.toValueStream(replayValue: true)
5962
.map((event) => event.text)
6063
.debounceTime(const Duration(milliseconds: 500))
6164
.where((s) => s.isNotEmpty)
6265
.distinct()
6366
.switchMap((value) => Stream.periodic(
6467
const Duration(milliseconds: 500), (i) => '$value..$i'))
65-
.listen(print);
68+
.publishState('initial')
69+
..connect().disposedBy(bag);
6670
}
6771

6872
@override
6973
void dispose() {
70-
subscription.cancel();
7174
controller.dispose();
7275
super.dispose();
7376
}
@@ -87,6 +90,19 @@ class _MainPageState extends State<MainPage> {
8790
controller: controller,
8891
decoration: const InputDecoration(filled: true),
8992
),
93+
Expanded(
94+
child: RxStreamBuilder<String>(
95+
stream: stateStream,
96+
builder: (context, state) {
97+
return Center(
98+
child: Text(
99+
state,
100+
style: Theme.of(context).textTheme.titleMedium,
101+
),
102+
);
103+
},
104+
),
105+
),
90106
],
91107
),
92108
),

0 commit comments

Comments
 (0)