Skip to content

Commit

Permalink
merge the null safety branch into master (flutter#65)
Browse files Browse the repository at this point in the history
* opt into null safety

* allow Future?, add example

* update versions

* update SDK constraint for null safety

* update sdk constraint

Co-authored-by: David Morgan <davidmorgan@google.com>
Co-authored-by: Kevin Moore <kevmoo@google.com>
  • Loading branch information
3 people authored Jul 15, 2020
1 parent c69d70e commit 643f247
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.10.0-nnbd

- Migrate to null safety.

## 1.9.2

Revert changes in `1.9.1` due to problems moving `unawaited` to `meta`.
Expand Down
3 changes: 3 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
# including a list of lints that are intentionally _not_ enforced.

include: lib/analysis_options.yaml
analyzer:
enable-experiment:
- non-nullable
16 changes: 16 additions & 0 deletions example/example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:pedantic/pedantic.dart';

void main() async {
// Normally, calling a function that returns a Future from an async method
// would require you to ignore the unawaited_futures lint with this analyzer
// syntax:
//
// ignore: unawaited_futures
doSomethingAsync();

// Wrapping it in a call to `unawaited` avoids that, since it doesn't
// return a Future. This is more explicit, and harder to get wrong.
unawaited(doSomethingAsync());
}

Future<void> doSomethingAsync() async {}
2 changes: 1 addition & 1 deletion lib/pedantic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ import 'dart:async' show Future;
/// unawaited(log('Preferences saved!'));
/// }
/// ```
void unawaited(Future<void> future) {}
void unawaited(Future<void>? future) {}
7 changes: 2 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: pedantic
version: 1.9.2
version: 1.10.0-nnbd
description: >-
The Dart analyzer settings and best practices used internally at Google.
homepage: https://github.com/dart-lang/pedantic

environment:
sdk: '>=2.1.1 <3.0.0'

dependencies:
meta: ^1.2.2
sdk: '>=2.9.0-18.0 <2.9.0'

0 comments on commit 643f247

Please sign in to comment.