diff --git a/packages/android_intent/lib/android_intent.dart b/packages/android_intent/lib/android_intent.dart index e0a779a06357..6a0b15a7d17e 100644 --- a/packages/android_intent/lib/android_intent.dart +++ b/packages/android_intent/lib/android_intent.dart @@ -43,9 +43,15 @@ class AndroidIntent { Future launch() async { assert(_platform.isAndroid); final Map args = {'action': action}; - if (category != null) args['category'] = category; - if (data != null) args['data'] = data; - if (arguments != null) args['arguments'] = arguments; + if (category != null) { + args['category'] = category; + } + if (data != null) { + args['data'] = data; + } + if (arguments != null) { + args['arguments'] = arguments; + } await _channel.invokeMethod('launch', args); } } diff --git a/packages/firebase_analytics/lib/firebase_analytics.dart b/packages/firebase_analytics/lib/firebase_analytics.dart index 458345ed96f9..58928e113f2e 100755 --- a/packages/firebase_analytics/lib/firebase_analytics.dart +++ b/packages/firebase_analytics/lib/firebase_analytics.dart @@ -67,7 +67,9 @@ class FirebaseAnalytics { /// /// [1]: https://www.google.com/policies/privacy/ Future setUserId(String id) async { - if (id == null) throw new ArgumentError.notNull('id'); + if (id == null) { + throw new ArgumentError.notNull('id'); + } await _channel.invokeMethod('setUserId', id); } @@ -91,7 +93,9 @@ class FirebaseAnalytics { /// https://firebase.google.com/docs/reference/ios/firebaseanalytics/api/reference/Classes/FIRAnalytics#setscreennamescreenclass Future setCurrentScreen( {@required String screenName, String screenClassOverride}) async { - if (screenName == null) throw new ArgumentError.notNull('screenName'); + if (screenName == null) { + throw new ArgumentError.notNull('screenName'); + } await _channel.invokeMethod('setCurrentScreen', { 'screenName': screenName, @@ -113,7 +117,9 @@ class FirebaseAnalytics { /// user property names. Future setUserProperty( {@required String name, @required String value}) async { - if (name == null) throw new ArgumentError.notNull('name'); + if (name == null) { + throw new ArgumentError.notNull('name'); + } if (name.isEmpty || name.length > 24 || @@ -781,7 +787,9 @@ class FirebaseAnalyticsAndroid { /// /// This setting is persisted across app sessions. By default it is enabled. Future setAnalyticsCollectionEnabled(bool enabled) async { - if (enabled == null) throw new ArgumentError.notNull('enabled'); + if (enabled == null) { + throw new ArgumentError.notNull('enabled'); + } await _channel.invokeMethod('setAnalyticsCollectionEnabled', enabled); } @@ -790,7 +798,9 @@ class FirebaseAnalyticsAndroid { /// /// The default value is 10000 (10 seconds). Future setMinimumSessionDuration(int milliseconds) async { - if (milliseconds == null) throw new ArgumentError.notNull('milliseconds'); + if (milliseconds == null) { + throw new ArgumentError.notNull('milliseconds'); + } await _channel.invokeMethod('setMinimumSessionDuration', milliseconds); } @@ -799,7 +809,9 @@ class FirebaseAnalyticsAndroid { /// /// The default value is 1800000 (30 minutes). Future setSessionTimeoutDuration(int milliseconds) async { - if (milliseconds == null) throw new ArgumentError.notNull('milliseconds'); + if (milliseconds == null) { + throw new ArgumentError.notNull('milliseconds'); + } await _channel.invokeMethod('setSessionTimeoutDuration', milliseconds); } @@ -811,7 +823,9 @@ class FirebaseAnalyticsAndroid { Map filterOutNulls(Map parameters) { final Map filtered = {}; parameters.forEach((String key, dynamic value) { - if (value != null) filtered[key] = value; + if (value != null) { + filtered[key] = value; + } }); return filtered; } diff --git a/packages/firebase_database/example/lib/main.dart b/packages/firebase_database/example/lib/main.dart index c7600f2e6df9..66185a88eeb9 100755 --- a/packages/firebase_database/example/lib/main.dart +++ b/packages/firebase_database/example/lib/main.dart @@ -84,8 +84,8 @@ class _MyHomePageState extends State { children: [ new Flexible( child: new Center( + // ignore: prefer_const_constructors child: new Text( - // ignore: prefer_const_constructors 'Button tapped $_counter time${ _counter == 1 ? '' : 's' }.\n\n' 'This includes all devices, ever.', ), diff --git a/packages/firebase_database/lib/src/database_reference.dart b/packages/firebase_database/lib/src/database_reference.dart index 70087aaf7cb2..75ed7a807a2a 100644 --- a/packages/firebase_database/lib/src/database_reference.dart +++ b/packages/firebase_database/lib/src/database_reference.dart @@ -28,7 +28,9 @@ class DatabaseReference extends Query { /// refers to the root of your Firebase Database, it has no parent, and /// therefore parent() will return null. DatabaseReference parent() { - if (_pathComponents.isEmpty) return null; + if (_pathComponents.isEmpty) { + return null; + } return new DatabaseReference._( _database, (new List.from(_pathComponents)..removeLast())); } diff --git a/packages/firebase_database/lib/ui/firebase_animated_list.dart b/packages/firebase_database/lib/ui/firebase_animated_list.dart index 04839415fccd..aad95bddcea5 100755 --- a/packages/firebase_database/lib/ui/firebase_animated_list.dart +++ b/packages/firebase_database/lib/ui/firebase_animated_list.dart @@ -162,7 +162,9 @@ class FirebaseAnimatedListState extends State { } void _onChildAdded(int index, DataSnapshot snapshot) { - if (!_loaded) return; // AnimatedList is not created yet + if (!_loaded) { + return; // AnimatedList is not created yet + } _animatedListKey.currentState.insertItem(index, duration: widget.duration); } @@ -201,7 +203,9 @@ class FirebaseAnimatedListState extends State { @override Widget build(BuildContext context) { - if (!_loaded) return widget.defaultChild ?? new Container(); + if (!_loaded) { + return widget.defaultChild ?? new Container(); + } return new AnimatedList( key: _animatedListKey, itemBuilder: _buildItem, diff --git a/packages/firebase_messaging/example/lib/main.dart b/packages/firebase_messaging/example/lib/main.dart index 8cc8dc146ca1..9249911bba46 100644 --- a/packages/firebase_messaging/example/lib/main.dart +++ b/packages/firebase_messaging/example/lib/main.dart @@ -113,7 +113,9 @@ class _PushMessagingExampleState extends State { }), ], )).then((bool shouldNavigate) { - if (shouldNavigate == true) _navigateToItemDetail(message); + if (shouldNavigate == true) { + _navigateToItemDetail(message); + } }); } @@ -121,7 +123,9 @@ class _PushMessagingExampleState extends State { final Item item = _itemForMessage(message); // Clear away dialogs Navigator.popUntil(context, (Route route) => route is PageRoute); - if (!item.route.isCurrent) Navigator.push(context, item.route); + if (!item.route.isCurrent) { + Navigator.push(context, item.route); + } } @override diff --git a/packages/google_sign_in/lib/google_sign_in.dart b/packages/google_sign_in/lib/google_sign_in.dart index d48cf9e9c59d..c37091989f05 100755 --- a/packages/google_sign_in/lib/google_sign_in.dart +++ b/packages/google_sign_in/lib/google_sign_in.dart @@ -51,7 +51,9 @@ class GoogleSignInAccount { ); // On Android, there isn't an API for refreshing the idToken, so re-use // the one we obtained on login. - if (response['idToken'] == null) response['idToken'] = _idToken; + if (response['idToken'] == null) { + response['idToken'] = _idToken; + } return new GoogleSignInAuthentication._(response); } @@ -216,7 +218,9 @@ class GoogleUserCircleAvatar extends StatelessWidget { /// where NN is the max width/height of the image, and "c" indicates we /// want the image cropped. String _sizedProfileImageUrl(double size) { - if (_primaryProfileImageUrl == null) return null; + if (_primaryProfileImageUrl == null) { + return null; + } final Uri profileUri = Uri.parse(_primaryProfileImageUrl); final List pathSegments = new List.from(profileUri.pathSegments); @@ -235,7 +239,9 @@ class GoogleUserCircleAvatar extends StatelessWidget { final String url = _sizedProfileImageUrl( MediaQuery.of(context).devicePixelRatio * constraints.maxWidth, ); - if (url == null) return new Container(); + if (url == null) { + return new Container(); + } return new ClipOval( child: new Image( image: new NetworkImage(url), diff --git a/packages/path_provider/lib/path_provider.dart b/packages/path_provider/lib/path_provider.dart index 95857f29e60c..4df9003a8e3e 100644 --- a/packages/path_provider/lib/path_provider.dart +++ b/packages/path_provider/lib/path_provider.dart @@ -22,7 +22,9 @@ const MethodChannel _channel = /// On Android, this uses the `getCacheDir` API on the context. Future getTemporaryDirectory() async { final String path = await _channel.invokeMethod('getTemporaryDirectory'); - if (path == null) return null; + if (path == null) { + return null; + } return new Directory(path); } @@ -36,7 +38,9 @@ Future getTemporaryDirectory() async { Future getApplicationDocumentsDirectory() async { final String path = await _channel.invokeMethod('getApplicationDocumentsDirectory'); - if (path == null) return null; + if (path == null) { + return null; + } return new Directory(path); } @@ -52,6 +56,8 @@ Future getExternalStorageDirectory() async { if (Platform.isIOS) throw new UnsupportedError("Functionality not available on iOS"); final String path = await _channel.invokeMethod('getStorageDirectory'); - if (path == null) return null; + if (path == null) { + return null; + } return new Directory(path); } diff --git a/packages/shared_preferences/example/lib/main.dart b/packages/shared_preferences/example/lib/main.dart index ec1277ae9491..823c5581b0f3 100644 --- a/packages/shared_preferences/example/lib/main.dart +++ b/packages/shared_preferences/example/lib/main.dart @@ -53,8 +53,8 @@ class SharedPreferencesDemoState extends State { if (snapshot.connectionState == ConnectionState.waiting) return const Text('Loading...'); final int counter = snapshot.requireData.getInt('counter') ?? 0; + // ignore: prefer_const_constructors return new Text( - // ignore: prefer_const_constructors 'Button tapped $counter time${ counter == 1 ? '' : 's' }.\n\n' 'This should persist across restarts.', ); diff --git a/packages/url_launcher/lib/url_launcher.dart b/packages/url_launcher/lib/url_launcher.dart index 99086f23736c..77b94e96fb94 100644 --- a/packages/url_launcher/lib/url_launcher.dart +++ b/packages/url_launcher/lib/url_launcher.dart @@ -25,7 +25,9 @@ Future launch(String urlString) { /// Checks whether the specified URL can be handled by some app installed on the /// device. Future canLaunch(String urlString) async { - if (urlString == null) return false; + if (urlString == null) { + return false; + } return await _channel.invokeMethod( 'canLaunch', urlString,