Skip to content

Commit 3c45463

Browse files
committed
prefer_const_constructors
1 parent fdb82b9 commit 3c45463

File tree

13 files changed

+19
-11
lines changed

13 files changed

+19
-11
lines changed

lib/common/event/event_bus.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'dart:async';
1111
/// filter events.
1212
///
1313
class EventBus {
14-
StreamController _streamController;
14+
final StreamController _streamController;
1515

1616
/// Controller for the event bus stream.
1717
StreamController get streamController => _streamController;

lib/common/localization/default_localizations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class GSYLocalizations {
1111

1212
///根据不同 locale.languageCode 加载不同语言对应
1313
///GSYStringEn和GSYStringZh都继承了GSYStringBase
14-
static Map<String, GSYStringBase> _localizedValues = {
14+
static final Map<String, GSYStringBase> _localizedValues = {
1515
'en': GSYStringEn(),
1616
'zh': GSYStringZh(),
1717
};

lib/common/net/api.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class HttpManager {
1616
static const CONTENT_TYPE_JSON = "application/json";
1717
static const CONTENT_TYPE_FORM = "application/x-www-form-urlencoded";
1818

19-
Dio _dio = Dio(); // 使用默认配置
19+
final Dio _dio = Dio(); // 使用默认配置
2020

2121
final TokenInterceptors _tokenInterceptors = TokenInterceptors();
2222

lib/common/net/trending/github_trending.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: unnecessary_string_escapes
2+
13
import 'package:dio/dio.dart';
24
import 'package:gsy_github_app_flutter/model/TrendingRepoModel.dart';
35
import 'package:gsy_github_app_flutter/common/net/api.dart';

lib/common/utils/html_utils.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: unnecessary_string_escapes
2+
13
import 'package:gsy_github_app_flutter/common/style/gsy_style.dart';
24

35
/// Created by guoshuyu

lib/page/trend/trend_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TrendBloc {
1616
bool get requested => _requested;
1717

1818
///rxdart 实现的 stream
19-
var _subject = PublishSubject<List<TrendingRepoModel>?>();
19+
final _subject = PublishSubject<List<TrendingRepoModel>?>();
2020

2121
Stream<List<TrendingRepoModel>?> get stream => _subject.stream;
2222

lib/widget/flutter_json_widget.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: unnecessary_string_escapes
2+
13
import 'package:flutter/material.dart';
24

35
class JsonViewerWidget extends StatefulWidget {

lib/widget/gsy_tabs.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ class _TabBarState extends State<TabBar> {
798798
bool get _controllerIsValid => _controller?.animation != null;
799799

800800
void _updateTabController() {
801-
final TabController? newController =
801+
final TabController newController =
802802
widget.controller ?? DefaultTabController.of(context);
803803
assert(() {
804804
if (newController == null) {
@@ -1208,7 +1208,7 @@ class _TabBarViewState extends State<TabBarView> {
12081208
bool get _controllerIsValid => _controller?.animation != null;
12091209

12101210
void _updateTabController() {
1211-
final TabController? newController =
1211+
final TabController newController =
12121212
widget.controller ?? DefaultTabController.of(context);
12131213
assert(() {
12141214
if (newController == null) {
@@ -1492,7 +1492,7 @@ class TabPageSelector extends StatelessWidget {
14921492
ColorTween(begin: fixColor, end: fixSelectedColor);
14931493
final ColorTween previousColorTween =
14941494
ColorTween(begin: fixSelectedColor, end: fixColor);
1495-
final TabController? tabController =
1495+
final TabController tabController =
14961496
controller ?? DefaultTabController.of(context);
14971497
assert(() {
14981498
if (tabController == null) {

lib/widget/markdown/gsy_markdown_widget.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: unnecessary_string_escapes
2+
13
import 'dart:io';
24

35
import 'package:flutter/material.dart';

lib/widget/menu/src/arc_progress_indicator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ArcProgressIndicator extends StatelessWidget {
4040
Widget build(BuildContext context) {
4141
TextPainter? _iconPainter;
4242
final ThemeData theme = Theme.of(context);
43-
final Color? _iconColor = iconColor ?? theme.colorScheme.secondary;
43+
final Color _iconColor = iconColor ?? theme.colorScheme.secondary;
4444
final double? _iconSize = iconSize ?? IconTheme.of(context).size;
4545

4646
if (icon != null) {

0 commit comments

Comments
 (0)