Skip to content

Commit 5e7b0fb

Browse files
committed
refactor: Migrate to sound null safety
1 parent 1cae874 commit 5e7b0fb

File tree

5 files changed

+25
-19
lines changed

5 files changed

+25
-19
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [4.0.0+1]
2+
* docs: Update CHANGELOG.md
3+
4+
## [4.0.0]
5+
* refactor: Migrate to sound null safety
6+
17
## [3.0.5]
28
* fix: cancel the use of `nullOk` attribute
39

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ Loading|Text|CustomWidget
4949
### 🐮Getting started
5050

5151
#### 1. add dependencies into you project pubspec.yaml file
52-
``` dart
52+
``` yaml
5353
dependencies:
54-
bot_toast: ^3.0.5
54+
bot_toast: ^3.0.5
55+
# bot_toast: ^4.0.0 #null safety
5556
```
5657

5758
#### 2. import BotToast lib

README_zh.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ Loading|Text|CustomWidget
5353
### 🐮快速使用
5454

5555
#### 1. pubspec.yaml文件里添加依赖
56-
``` dart
56+
``` yaml
5757
dependencies:
58-
bot_toast: ^3.0.5
58+
bot_toast: ^3.0.5
59+
# bot_toast: ^4.0.0 #null safety
5960
```
6061

6162
#### 2. 导入BotToast库

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A really easy to use flutter toast library.Easy to use and feature
33
homepage: https://github.com/MMMzq/bot_toast
44
email: vivask770@163.com
55

6-
version: 3.0.5
6+
version: 4.0.0+1
77

88
environment:
99
sdk: '>=2.12.0-0 <3.0.0'

test/widget_test.dart

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,9 @@ void main() {
370370

371371
// ignore: must_be_immutable
372372
class TestApp extends StatelessWidget {
373-
final VoidCallback callback;
374-
final void Function(BuildContext ctx) contextCallback;
375-
final Widget child;
373+
final VoidCallback? callback;
374+
final void Function(BuildContext ctx)? contextCallback;
375+
final Widget? child;
376376

377377
TestApp({this.callback, this.child, this.contextCallback});
378378

@@ -391,17 +391,15 @@ class TestApp extends StatelessWidget {
391391
mainAxisSize: MainAxisSize.min,
392392
children: <Widget>[
393393
Builder(
394-
builder: (ctx) =>
395-
FlatButton(
396-
key: ValueKey('main'),
397-
onPressed: () async {
398-
callback?.call();
399-
contextCallback?.call(ctx);
400-
},
401-
child: Text(''))),
402-
child
403-
]
404-
..removeWhere((test) => test == null),
394+
builder: (ctx) => FlatButton(
395+
key: ValueKey('main'),
396+
onPressed: () async {
397+
callback?.call();
398+
contextCallback?.call(ctx);
399+
},
400+
child: Text(''))),
401+
if (child != null) child!
402+
],
405403
),
406404
),
407405
);

0 commit comments

Comments
 (0)