Skip to content

Commit b19d05e

Browse files
authored
1.4.0 (#16)
* 1.4.0 * 1.4.0
1 parent 60074c4 commit b19d05e

23 files changed

+136
-102
lines changed

.github/workflows/dart.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ jobs:
3232
- name: Run tests
3333
run: flutter test --coverage --coverage-path=lcov.info
3434

35-
- uses: codecov/codecov-action@v1
35+
- uses: codecov/codecov-action@v2.1.0
3636

analysis_options.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
include: package:pedantic/analysis_options.1.11.0.yaml
1+
include: package:flutter_lints/flutter.yaml
22
linter:
33
rules:
44
- public_member_api_docs
55
- prefer_final_locals
6-
- prefer_relative_imports
6+
- prefer_relative_imports
7+
# https://github.com/dart-lang/lints#migrating-from-packagepedantic
8+
- always_declare_return_types
9+
- prefer_single_quotes
10+
- unawaited_futures
11+
- unsafe_html

example/analysis_options.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
include: package:pedantic/analysis_options.1.11.0.yaml
1+
include: package:flutter_lints/flutter.yaml
22
linter:
33
rules:
44
- prefer_final_locals
5-
- prefer_relative_imports
5+
- prefer_relative_imports
6+
# https://github.com/dart-lang/lints#migrating-from-packagepedantic
7+
- always_declare_return_types
8+
- prefer_single_quotes
9+
- unawaited_futures
10+
- unsafe_html

example/lib/data/api.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:convert';
22

33
import 'package:built_collection/built_collection.dart';
4+
import 'package:flutter/foundation.dart';
45
import 'package:http/http.dart' as http;
56

67
import 'comment.dart';
@@ -34,5 +35,5 @@ class Api {
3435

3536
void dispose() => _client.close();
3637

37-
void _logRequest(String url) => print('--> GET $url');
38+
void _logRequest(String url) => debugPrint('--> GET $url');
3839
}

example/lib/data/comment.g.dart

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/data/serializers.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const commentsBuiltList = FullType(
1212
);
1313

1414
@SerializersFor([Comment])
15-
final Serializers _serializers = _$_serializers;
16-
final Serializers serializers = (_serializers.toBuilder()
15+
final Serializers serializers = (_$serializers.toBuilder()
1716
..addBuilderFactory(
1817
commentsBuiltList,
1918
() => ListBuilder<Comment>(),

example/lib/data/serializers.g.dart

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/detail_page.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class DetailPage extends StatelessWidget {
1515
Widget build(BuildContext context) {
1616
return Scaffold(
1717
appBar: AppBar(
18-
title: Text('Comment detail'),
18+
title: const Text('Comment detail'),
1919
),
2020
body: Container(
21-
constraints: BoxConstraints.expand(),
21+
constraints: const BoxConstraints.expand(),
2222
child: Consumer<Api>(
2323
builder: (context, api) {
24-
final loadDetail = () => api.getCommentBy(id: comment.id);
24+
Stream<Comment> loadDetail() => api.getCommentBy(id: comment.id);
2525

2626
return LoaderWidget<Comment>(
2727
blocProvider: () {
@@ -53,32 +53,32 @@ class DetailPage extends StatelessWidget {
5353
crossAxisAlignment: CrossAxisAlignment.center,
5454
children: <Widget>[
5555
ListTile(
56-
leading: Icon(Icons.label),
57-
title: Text('Post id'),
56+
leading: const Icon(Icons.label),
57+
title: const Text('Post id'),
5858
subtitle: Text(comment.postId.toString()),
5959
),
6060
const Divider(),
6161
ListTile(
62-
leading: Icon(Icons.add),
63-
title: Text('Id'),
62+
leading: const Icon(Icons.add),
63+
title: const Text('Id'),
6464
subtitle: Text(comment.id.toString()),
6565
),
6666
const Divider(),
6767
ListTile(
68-
leading: Icon(Icons.person),
69-
title: Text('Name'),
68+
leading: const Icon(Icons.person),
69+
title: const Text('Name'),
7070
subtitle: Text(comment.name),
7171
),
7272
const Divider(),
7373
ListTile(
74-
leading: Icon(Icons.email),
75-
title: Text('Email'),
74+
leading: const Icon(Icons.email),
75+
title: const Text('Email'),
7676
subtitle: Text(comment.email),
7777
),
7878
const Divider(),
7979
ExpansionTile(
80-
leading: Icon(Icons.message),
81-
title: Text('Body'),
80+
leading: const Icon(Icons.message),
81+
title: const Text('Body'),
8282
children: <Widget>[
8383
Text(comment.body),
8484
],

example/lib/home_page.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class HomePage extends StatelessWidget {
1717
Widget build(BuildContext context) {
1818
return Scaffold(
1919
appBar: AppBar(
20-
title: Text('Demo stream_loader'),
20+
title: const Text('Demo stream_loader'),
2121
),
2222
body: Container(
23-
constraints: BoxConstraints.expand(),
23+
constraints: const BoxConstraints.expand(),
2424
child: Consumer<Api>(
2525
builder: (context, api) {
2626
return LoaderWidget<BuiltList<Comment>>(
@@ -44,14 +44,14 @@ class HomePage extends StatelessWidget {
4444
const SizedBox(height: 8),
4545
RaisedButton(
4646
onPressed: bloc.fetch,
47-
child: Text('Retry'),
47+
child: const Text('Retry'),
4848
)
4949
],
5050
),
5151
);
5252
}
5353
if (state.isLoading) {
54-
return Center(
54+
return const Center(
5555
child: CircularProgressIndicator(),
5656
);
5757
}
@@ -60,7 +60,7 @@ class HomePage extends StatelessWidget {
6060
return RefreshIndicator(
6161
onRefresh: bloc.refresh,
6262
child: ListView.separated(
63-
physics: AlwaysScrollableScrollPhysics(),
63+
physics: const AlwaysScrollableScrollPhysics(),
6464
itemCount: items.length,
6565
itemBuilder: (context, index) {
6666
final comment = items[index];

example/lib/main.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ void main() {
1010
runApp(
1111
Provider<Api>.value(
1212
api,
13-
child: MyApp(),
13+
child: const MyApp(),
1414
),
1515
);
1616
}
1717

1818
class MyApp extends StatelessWidget {
19+
const MyApp({Key? key}) : super(key: key);
20+
1921
@override
2022
Widget build(BuildContext context) {
2123
return MaterialApp(

0 commit comments

Comments
 (0)