add @required when there's an assert not null (#9124)

* add @required when there's an assert not null

* address review comments
This commit is contained in:
Alexandre Ardhuin
2017-03-31 18:34:13 +02:00
committed by GitHub
parent 86e9fc1c68
commit 2de61a0853
70 changed files with 247 additions and 164 deletions

View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:meta/meta.dart' show required;
import 'package:xml/xml.dart' as xml;
import 'android/android_sdk.dart';
@@ -18,7 +19,7 @@ abstract class ApplicationPackage {
/// Package ID from the Android Manifest or equivalent.
final String id;
ApplicationPackage({ this.id }) {
ApplicationPackage({ @required this.id }) {
assert(id != null);
}
@@ -41,8 +42,8 @@ class AndroidApk extends ApplicationPackage {
AndroidApk({
String id,
this.apkPath,
this.launchActivity
@required this.apkPath,
@required this.launchActivity
}) : super(id: id) {
assert(apkPath != null);
assert(launchActivity != null);

View File

@@ -4,6 +4,8 @@
import 'dart:async';
import 'package:meta/meta.dart' show required;
import '../android/android_sdk.dart';
import '../android/gradle.dart';
import '../base/common.dart';
@@ -14,7 +16,7 @@ import 'build.dart';
export '../android/android_device.dart' show AndroidDevice;
class ApkKeystoreInfo {
ApkKeystoreInfo({ this.keystore, this.password, this.keyAlias, this.keyPassword }) {
ApkKeystoreInfo({ this.keystore, this.password, this.keyAlias, @required this.keyPassword }) {
assert(keystore != null);
}

View File

@@ -4,6 +4,8 @@
import 'dart:async';
import 'package:meta/meta.dart' show required;
import 'artifacts.dart';
import 'asset.dart';
import 'base/common.dart';
@@ -27,10 +29,10 @@ const String _kKernelKey = 'kernel_blob.bin';
const String _kSnapshotKey = 'snapshot_blob.bin';
Future<int> createSnapshot({
String mainPath,
String snapshotPath,
@required String mainPath,
@required String snapshotPath,
String depfilePath,
String packages
@required String packages
}) {
assert(mainPath != null);
assert(snapshotPath != null);

View File

@@ -72,7 +72,7 @@ typedef Future<Null> _Finalizer();
class _FlutterPlatform extends PlatformPlugin {
_FlutterPlatform({
this.shellPath,
@required this.shellPath,
this.collector,
this.debuggerMode,
this.explicitObservatoryPort,

View File

@@ -8,6 +8,7 @@ import 'dart:convert' show BASE64;
import 'package:file/file.dart';
import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
import 'package:meta/meta.dart' show required;
import 'package:stream_channel/stream_channel.dart';
import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
@@ -680,8 +681,8 @@ class VM extends ServiceObjectOwner {
// Write one file into a file system.
Future<Map<String, dynamic>> writeDevFSFile(String fsName, {
String path,
List<int> fileContents
@required String path,
@required List<int> fileContents
}) {
assert(path != null);
assert(fileContents != null);