Skip to content

Commit

Permalink
refactor: Migrate to sound null safety
Browse files Browse the repository at this point in the history
  • Loading branch information
MMMzq committed Feb 19, 2021
1 parent 1cae874 commit 5e7b0fb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [4.0.0+1]
* docs: Update CHANGELOG.md

## [4.0.0]
* refactor: Migrate to sound null safety

## [3.0.5]
* fix: cancel the use of `nullOk` attribute

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ Loading|Text|CustomWidget
### 🐮Getting started

#### 1. add dependencies into you project pubspec.yaml file
``` dart
``` yaml
dependencies:
bot_toast: ^3.0.5
bot_toast: ^3.0.5
# bot_toast: ^4.0.0 #null safety
```

#### 2. import BotToast lib
Expand Down
5 changes: 3 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ Loading|Text|CustomWidget
### 🐮快速使用

#### 1. pubspec.yaml文件里添加依赖
``` dart
``` yaml
dependencies:
bot_toast: ^3.0.5
bot_toast: ^3.0.5
# bot_toast: ^4.0.0 #null safety
```

#### 2. 导入BotToast库
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A really easy to use flutter toast library.Easy to use and feature
homepage: https://github.com/MMMzq/bot_toast
email: vivask770@163.com

version: 3.0.5
version: 4.0.0+1

environment:
sdk: '>=2.12.0-0 <3.0.0'
Expand Down
26 changes: 12 additions & 14 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ void main() {

// ignore: must_be_immutable
class TestApp extends StatelessWidget {
final VoidCallback callback;
final void Function(BuildContext ctx) contextCallback;
final Widget child;
final VoidCallback? callback;
final void Function(BuildContext ctx)? contextCallback;
final Widget? child;

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

Expand All @@ -391,17 +391,15 @@ class TestApp extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Builder(
builder: (ctx) =>
FlatButton(
key: ValueKey('main'),
onPressed: () async {
callback?.call();
contextCallback?.call(ctx);
},
child: Text(''))),
child
]
..removeWhere((test) => test == null),
builder: (ctx) => FlatButton(
key: ValueKey('main'),
onPressed: () async {
callback?.call();
contextCallback?.call(ctx);
},
child: Text(''))),
if (child != null) child!
],
),
),
);
Expand Down

0 comments on commit 5e7b0fb

Please sign in to comment.