Commit 2de61a08 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

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

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

* address review comments
parent 86e9fc1c
......@@ -31,8 +31,8 @@ const double _kAppBarMidHeight = 256.0;
// TODO(hansmuller): it would be worth adding something like this to the framework.
class _RenderStatusBarPaddingSliver extends RenderSliver {
_RenderStatusBarPaddingSliver({
double maxHeight,
double scrollFactor,
@required double maxHeight,
@required double scrollFactor,
}) : _maxHeight = maxHeight, _scrollFactor = scrollFactor {
assert(maxHeight != null && maxHeight >= 0.0);
assert(scrollFactor != null && scrollFactor >= 1.0);
......@@ -264,8 +264,8 @@ class _AllSectionsView extends AnimatedWidget {
_AllSectionsView({
Key key,
this.sectionIndex,
this.sections,
this.selectedIndex,
@required this.sections,
@required this.selectedIndex,
this.minHeight,
this.midHeight,
this.maxHeight,
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'sections.dart';
......@@ -10,7 +11,7 @@ const double kSectionIndicatorWidth = 32.0;
// The card for a single section. Displays the section's gradient and background image.
class SectionCard extends StatelessWidget {
SectionCard({ Key key, this.section }) : super(key: key) {
SectionCard({ Key key, @required this.section }) : super(key: key) {
assert(section != null);
}
......@@ -60,7 +61,12 @@ class SectionTitle extends StatelessWidget {
color: const Color(0x19000000),
);
SectionTitle({ Key key, this.section, this.scale, this.opacity }) : super(key: key) {
SectionTitle({
Key key,
@required this.section,
@required this.scale,
@required this.opacity,
}) : super(key: key) {
assert(section != null);
assert(scale != null);
assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
......@@ -115,7 +121,7 @@ class SectionIndicator extends StatelessWidget {
// Display a single SectionDetail.
class SectionDetailView extends StatelessWidget {
SectionDetailView({ Key key, this.detail }) : super(key: key) {
SectionDetailView({ Key key, @required this.detail }) : super(key: key) {
assert(detail != null && detail.imageAsset != null);
assert((detail.imageAsset ?? detail.title) != null);
}
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/material.dart';
const double kColorItemHeight = 48.0;
......@@ -41,7 +42,12 @@ final List<Palette> allPalettes = <Palette>[
class ColorItem extends StatelessWidget {
ColorItem({ Key key, this.index, this.color, this.prefix: '' }) : super(key: key) {
ColorItem({
Key key,
@required this.index,
@required this.color,
this.prefix: '',
}) : super(key: key) {
assert(index != null);
assert(color != null);
assert(prefix != null);
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/material.dart';
class TravelDestination {
......@@ -36,7 +37,7 @@ final List<TravelDestination> destinations = <TravelDestination>[
];
class TravelDestinationItem extends StatelessWidget {
TravelDestinationItem({ Key key, this.destination }) : super(key: key) {
TravelDestinationItem({ Key key, @required this.destination }) : super(key: key) {
assert(destination != null && destination.isValid);
}
......
......@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:intl/intl.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
// This demo is based on
// https://material.google.com/components/dialogs.html#dialogs-full-screen-dialogs
......@@ -15,7 +16,7 @@ enum DismissDialogAction {
}
class DateTimeItem extends StatelessWidget {
DateTimeItem({ Key key, DateTime dateTime, this.onChanged })
DateTimeItem({ Key key, DateTime dateTime, @required this.onChanged })
: date = new DateTime(dateTime.year, dateTime.month, dateTime.day),
time = new TimeOfDay(hour: dateTime.hour, minute: dateTime.minute),
super(key: key) {
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/material.dart';
enum GridDemoTileStyle {
......@@ -143,9 +144,9 @@ class _GridPhotoViewerState extends State<GridPhotoViewer> with SingleTickerProv
class GridDemoPhotoItem extends StatelessWidget {
GridDemoPhotoItem({
Key key,
this.photo,
this.tileStyle,
this.onBannerTap
@required this.photo,
@required this.tileStyle,
@required this.onBannerTap
}) : super(key: key) {
assert(photo != null && photo.isValid);
assert(tileStyle != null);
......
......@@ -116,7 +116,7 @@ class _ShrineGridDelegate extends SliverGridDelegate {
// Displays the Vendor's name and avatar.
class _VendorItem extends StatelessWidget {
_VendorItem({ Key key, this.vendor }) : super(key: key) {
_VendorItem({ Key key, @required this.vendor }) : super(key: key) {
assert(vendor != null);
}
......@@ -148,7 +148,7 @@ class _VendorItem extends StatelessWidget {
// Displays the product's price. If the product is in the shopping cart then the
// background is highlighted.
abstract class _PriceItem extends StatelessWidget {
_PriceItem({ Key key, this.product }) : super(key: key) {
_PriceItem({ Key key, @required this.product }) : super(key: key) {
assert(product != null);
}
......@@ -240,7 +240,8 @@ class _HeadingLayout extends MultiChildLayoutDelegate {
// A card that highlights the "featured" catalog item.
class _Heading extends StatelessWidget {
_Heading({ Key key, this.product }) : super(key: key) {
_Heading({ Key key, @required this.product }) : super(key: key) {
assert(product != null);
assert(product.featureTitle != null);
assert(product.featureDescription != null);
}
......@@ -293,7 +294,7 @@ class _Heading extends StatelessWidget {
// A card that displays a product's image, price, and vendor. The _ProductItem
// cards appear in a grid below the heading.
class _ProductItem extends StatelessWidget {
_ProductItem({ Key key, this.product, this.onPressed }) : super(key: key) {
_ProductItem({ Key key, @required this.product, this.onPressed }) : super(key: key) {
assert(product != null);
}
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../shrine_demo.dart' show ShrinePageRoute;
......@@ -11,7 +12,12 @@ import 'shrine_types.dart';
// Displays the product title's, description, and order quantity dropdown.
class _ProductItem extends StatelessWidget {
_ProductItem({ Key key, this.product, this.quantity, this.onChanged }) : super(key: key) {
_ProductItem({
Key key,
@required this.product,
@required this.quantity,
@required this.onChanged,
}) : super(key: key) {
assert(product != null);
assert(quantity != null);
assert(onChanged != null);
......@@ -64,7 +70,7 @@ class _ProductItem extends StatelessWidget {
// Vendor name and description
class _VendorItem extends StatelessWidget {
_VendorItem({ Key key, this.vendor }) : super(key: key) {
_VendorItem({ Key key, @required this.vendor }) : super(key: key) {
assert(vendor != null);
}
......@@ -135,7 +141,12 @@ class _HeadingLayout extends MultiChildLayoutDelegate {
// Describes a product and vendor in detail, supports specifying
// a order quantity (0-5). Appears at the top of the OrderPage.
class _Heading extends StatelessWidget {
_Heading({ Key key, this.product, this.quantity, this.quantityChanged }) : super(key: key) {
_Heading({
Key key,
@required this.product,
@required this.quantity,
this.quantityChanged,
}) : super(key: key) {
assert(product != null);
assert(quantity != null && quantity >= 0 && quantity <= 5);
}
......@@ -197,7 +208,12 @@ class _Heading extends StatelessWidget {
}
class OrderPage extends StatefulWidget {
OrderPage({ Key key, this.order, this.products, this.shoppingCart }) : super(key: key) {
OrderPage({
Key key,
@required this.order,
@required this.products,
@required this.shoppingCart,
}) : super(key: key) {
assert(order != null);
assert(products != null && products.isNotEmpty);
assert(shoppingCart != null);
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'shrine_theme.dart';
......@@ -16,8 +17,8 @@ enum ShrineAction {
class ShrinePage extends StatefulWidget {
ShrinePage({
Key key,
this.scaffoldKey,
this.body,
@required this.scaffoldKey,
@required this.body,
this.floatingActionButton,
this.products,
this.shoppingCart
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/material.dart';
class ShrineStyle extends TextStyle {
......@@ -26,7 +27,7 @@ TextStyle abrilFatfaceRegular34(Color color) => new ShrineStyle.abrilFatface(34.
/// InheritedWidget is shared by all of the routes and widgets created for
/// the Shrine app.
class ShrineTheme extends InheritedWidget {
ShrineTheme({ Key key, Widget child }) : super(key: key, child: child) {
ShrineTheme({ Key key, @required Widget child }) : super(key: key, child: child) {
assert(child != null);
}
......
......@@ -4,6 +4,8 @@
import 'dart:ui' show hashValues;
import 'package:flutter/foundation.dart';
class Vendor {
const Vendor({
this.name,
......@@ -64,7 +66,7 @@ class Product {
}
class Order {
Order({ this.product, this.quantity: 1, this.inCart: false }) {
Order({ @required this.product, this.quantity: 1, this.inCart: false }) {
assert(product != null);
assert(quantity != null && quantity >= 0);
assert(inCart != null);
......
......@@ -2,10 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class TextStyleItem extends StatelessWidget {
TextStyleItem({ Key key, this.name, this.style, this.text }) : super(key: key) {
TextStyleItem({
Key key,
@required this.name,
@required this.style,
@required this.text,
}) : super(key: key) {
assert(name != null);
assert(style != null);
assert(text != null);
......
......@@ -4,7 +4,7 @@
import 'dart:math' as math;
import 'package:flutter/foundation.dart' show defaultTargetPlatform;
import 'package:flutter/foundation.dart' show defaultTargetPlatform, required;
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
......@@ -90,9 +90,9 @@ class GalleryDrawer extends StatelessWidget {
GalleryDrawer({
Key key,
this.useLightTheme,
this.onThemeChanged,
@required this.onThemeChanged,
this.timeDilation,
this.onTimeDilationChanged,
@required this.onTimeDilationChanged,
this.showPerformanceOverlay,
this.onShowPerformanceOverlayChanged,
this.checkerboardRasterCacheImages,
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'drawer.dart';
......@@ -68,9 +69,9 @@ class GalleryHome extends StatefulWidget {
GalleryHome({
Key key,
this.useLightTheme,
this.onThemeChanged,
@required this.onThemeChanged,
this.timeDilation,
this.onTimeDilationChanged,
@required this.onTimeDilationChanged,
this.showPerformanceOverlay,
this.onShowPerformanceOverlayChanged,
this.checkerboardRasterCacheImages,
......
......@@ -4,6 +4,7 @@
import 'dart:developer';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../demo/all.dart';
......@@ -11,7 +12,13 @@ import '../demo/all.dart';
typedef Widget GalleryDemoBuilder();
class GalleryItem extends StatelessWidget {
GalleryItem({ this.title, this.subtitle, this.category, this.routeName, this.buildRoute }) {
GalleryItem({
@required this.title,
this.subtitle,
@required this.category,
@required this.routeName,
@required this.buildRoute,
}) {
assert(title != null);
assert(category != null);
assert(routeName != null);
......
......@@ -4,13 +4,14 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
typedef Future<String> UpdateUrlFetcher();
class Updater extends StatefulWidget {
Updater({ this.updateUrlFetcher, this.child, Key key }) : super(key: key) {
Updater({ @required this.updateUrlFetcher, this.child, Key key }) : super(key: key) {
assert(updateUrlFetcher != null);
}
......
......@@ -5,6 +5,7 @@
import 'dart:convert';
import 'dart:isolate';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
......@@ -16,7 +17,7 @@ typedef void OnResultListener(String result);
// The choice of JSON parsing here is meant as an example that might surface
// in real-world applications.
class Calculator {
Calculator({ this.onProgressListener, this.onResultListener, String data })
Calculator({ @required this.onProgressListener, @required this.onResultListener, String data })
// In order to keep the example files smaller, we "cheat" a little and
// replicate our small json string into a 10,000-element array.
: _data = _replicateJson(data, 10000) {
......@@ -85,7 +86,7 @@ class CalculationMessage {
// This class manages these ports and maintains state related to the
// progress of the background computation.
class CalculationManager {
CalculationManager({ this.onProgressListener, this.onResultListener })
CalculationManager({ @required this.onProgressListener, @required this.onResultListener })
: _receivePort = new ReceivePort() {
assert(onProgressListener != null);
assert(onResultListener != null);
......
......@@ -2,21 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
enum StockMode { optimistic, pessimistic }
enum BackupMode { enabled, disabled }
class StockConfiguration {
StockConfiguration({
this.stockMode,
this.backupMode,
this.debugShowGrid,
this.debugShowSizes,
this.debugShowBaselines,
this.debugShowLayers,
this.debugShowPointers,
this.debugShowRainbow,
this.showPerformanceOverlay,
this.showSemanticsDebugger
@required this.stockMode,
@required this.backupMode,
@required this.debugShowGrid,
@required this.debugShowSizes,
@required this.debugShowBaselines,
@required this.debugShowLayers,
@required this.debugShowPointers,
@required this.debugShowRainbow,
@required this.showPerformanceOverlay,
@required this.showSemanticsDebugger
}) {
assert(stockMode != null);
assert(backupMode != null);
......
......@@ -324,8 +324,8 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do
///
/// The parent and curve arguments must not be null.
CurvedAnimation({
this.parent,
this.curve,
@required this.parent,
@required this.curve,
this.reverseCurve
}) {
assert(parent != null);
......@@ -546,8 +546,8 @@ abstract class CompoundAnimation<T> extends Animation<T>
/// Creates a CompoundAnimation. Both arguments must be non-null. Either can
/// be a CompoundAnimation itself to combine multiple animations.
CompoundAnimation({
this.first,
this.next,
@required this.first,
@required this.next,
}) {
assert(first != null);
assert(next != null);
......
......@@ -4,6 +4,8 @@
import 'dart:ui' show Color, Size, Rect;
import 'package:flutter/foundation.dart';
import 'animation.dart';
import 'animations.dart';
import 'curves.dart';
......@@ -231,7 +233,7 @@ class CurveTween extends Animatable<double> {
/// Creates a curve tween.
///
/// The [curve] argument must not be null.
CurveTween({ this.curve }) {
CurveTween({ @required this.curve }) {
assert(curve != null);
}
......
......@@ -189,7 +189,7 @@ const double _kAdjustmentUnit = 0.1; // Matches iOS implementation of material s
class _RenderCupertinoSlider extends RenderConstrainedBox implements SemanticsActionHandler {
_RenderCupertinoSlider({
double value,
@required double value,
int divisions,
Color activeColor,
this.onChanged,
......
......@@ -135,8 +135,8 @@ const Duration _kToggleDuration = const Duration(milliseconds: 200);
class _RenderCupertinoSwitch extends RenderConstrainedBox implements SemanticsActionHandler {
_RenderCupertinoSwitch({
bool value,
Color activeColor,
@required bool value,
@required Color activeColor,
ValueChanged<bool> onChanged,
@required TickerProvider vsync,
}) : _value = value,
......
......@@ -199,7 +199,7 @@ abstract class BindingBase {
/// service extension method is called with a new value.
@protected
void registerBoolServiceExtension({
String name,
@required String name,
@required AsyncValueGetter<bool> getter,
@required AsyncValueSetter<bool> setter
}) {
......
......@@ -487,9 +487,9 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
class _Circle {
_Circle({
this.state,
this.index,
this.color,
@required this.state,
@required this.index,
@required this.color,
@required TickerProvider vsync,
}) {
assert(state != null);
......
......@@ -4,6 +4,7 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'colors.dart';
......@@ -49,8 +50,8 @@ class BottomSheet extends StatefulWidget {
BottomSheet({
Key key,
this.animationController,
this.onClosing,
this.builder
@required this.onClosing,
@required this.builder
}) : super(key: key) {
assert(onClosing != null);
assert(builder != null);
......@@ -256,7 +257,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
/// * [BottomSheet]
/// * [Scaffold.showBottomSheet]
/// * <https://material.google.com/components/bottom-sheets.html#bottom-sheets-modal-bottom-sheets>
Future<T> showModalBottomSheet<T>({ BuildContext context, WidgetBuilder builder }) {
Future<T> showModalBottomSheet<T>({ @required BuildContext context, @required WidgetBuilder builder }) {
assert(context != null);
assert(builder != null);
return Navigator.push(context, new _ModalBottomSheetRoute<T>(
......
......@@ -253,11 +253,11 @@ class DataTable extends StatelessWidget {
/// otherwise it should be false.
DataTable({
Key key,
this.columns,
@required this.columns,
this.sortColumnIndex,
this.sortAscending: true,
this.onSelectAll,
this.rows
@required this.rows
}) : _onlyTextColumn = _initOnlyTextColumn(columns), super(key: key) {
assert(columns != null);
assert(columns.isNotEmpty);
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'colors.dart';
......@@ -117,7 +118,7 @@ class DrawerController extends StatefulWidget {
/// The [child] argument must not be null and is typically a [Drawer].
DrawerController({
GlobalKey key,
this.child
@required this.child
}) : super(key: key) {
assert(child != null);
}
......
......@@ -286,7 +286,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
this.selectedIndex,
this.elevation: 8,
this.theme,
this.style,
@required this.style,
}) {
assert(style != null);
}
......@@ -336,7 +336,7 @@ class DropdownMenuItem<T> extends StatelessWidget {
DropdownMenuItem({
Key key,
this.value,
this.child,
@required this.child,
}) : super(key: key) {
assert(child != null);
}
......@@ -372,7 +372,7 @@ class DropdownButtonHideUnderline extends InheritedWidget {
/// be given.
DropdownButtonHideUnderline({
Key key,
Widget child,
@required Widget child,
}) : super(key: key, child: child) {
assert(child != null);
}
......
......@@ -58,7 +58,7 @@ class FlatButton extends StatelessWidget {
this.disabledColor,
this.textTheme,
this.colorBrightness,
this.child
@required this.child
}) : super(key: key) {
assert(child != null);
}
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
......@@ -691,7 +692,7 @@ class _AnimatedLabel extends ImplicitlyAnimatedWidget {
_AnimatedLabel({
Key key,
this.text,
this.style,
@required this.style,
Curve curve: Curves.linear,
Duration duration,
}) : super(key: key, curve: curve, duration: duration) {
......
......@@ -195,7 +195,7 @@ class _CupertinoBackGestureController extends NavigationGestureController {
class MaterialPageRoute<T> extends PageRoute<T> {
/// Creates a page route for use in a material design app.
MaterialPageRoute({
this.builder,
@required this.builder,
RouteSettings settings: const RouteSettings(),
this.maintainState: true,
}) : super(settings: settings) {
......
......@@ -66,7 +66,7 @@ class PaginatedDataTable extends StatefulWidget {
Key key,
@required this.header,
this.actions,
this.columns,
@required this.columns,
this.sortColumnIndex,
this.sortAscending: true,
this.onSelectAll,
......
......@@ -438,9 +438,9 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
/// 12, 16, 24. The elevation defaults to 8, the appropriate elevation for popup
/// menus.
Future<T> showMenu<T>({
BuildContext context,
@required BuildContext context,
RelativeRect position,
List<PopupMenuEntry<T>> items,
@required List<PopupMenuEntry<T>> items,
T initialValue,
int elevation: 8
}) {
......
......@@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'progress_indicator.dart';
......@@ -81,9 +82,9 @@ class RefreshIndicator extends StatefulWidget {
/// [displacement] is 40.0 logical pixels.
RefreshIndicator({
Key key,
this.child,
@required this.child,
this.displacement: 40.0,
this.onRefresh,
@required this.onRefresh,
this.color,
this.backgroundColor
}) : super(key: key) {
......
......@@ -261,7 +261,7 @@ BoxConstraints _getAdditionalConstraints(String label) {
class _RenderSlider extends RenderConstrainedBox implements SemanticsActionHandler {
_RenderSlider({
double value,
@required double value,
int divisions,
String label,
Color activeColor,
......
......@@ -81,7 +81,7 @@ class SnackBarAction extends StatefulWidget {
/// The [label] and [onPressed] arguments must be non-null.
SnackBarAction({
Key key,
this.label,
@required this.label,
@required this.onPressed
}) : super(key: key) {
assert(label != null);
......
......@@ -131,7 +131,7 @@ class Stepper extends StatefulWidget {
/// The [steps], [type], and [currentStep] arguments must not be null.
Stepper({
Key key,
this.steps,
@required this.steps,
this.type: StepperType.vertical,
this.currentStep: 0,
this.onStepTapped,
......
......@@ -158,7 +158,7 @@ class _TabLabelBarRenderer extends RenderFlex {
MainAxisAlignment mainAxisAlignment,
CrossAxisAlignment crossAxisAlignment,
TextBaseline textBaseline,
this.onPerformLayout,
@required this.onPerformLayout,
}) : super(
children: children,
direction: direction,
......
......@@ -35,7 +35,7 @@ class Theme extends InheritedWidget {
Key key,
@required this.data,
this.isMaterialAppTheme: false,
Widget child
@required Widget child
}) : super(key: key, child: child) {
assert(child != null);
assert(data != null);
......
......@@ -184,36 +184,36 @@ class ThemeData {
/// create intermediate themes based on two themes created with the
/// [new ThemeData] constructor.
ThemeData.raw({
this.brightness,
this.primaryColor,
this.primaryColorBrightness,
this.accentColor,
this.accentColorBrightness,
this.canvasColor,
this.scaffoldBackgroundColor,
this.cardColor,
this.dividerColor,
this.highlightColor,
this.splashColor,
this.selectedRowColor,
this.unselectedWidgetColor,
this.disabledColor,
this.buttonColor,
this.secondaryHeaderColor,
this.textSelectionColor,
this.textSelectionHandleColor,
this.backgroundColor,
this.dialogBackgroundColor,
this.indicatorColor,
this.hintColor,
this.errorColor,
this.textTheme,
this.primaryTextTheme,
this.accentTextTheme,
this.iconTheme,
this.primaryIconTheme,
this.accentIconTheme,
this.platform
@required this.brightness,
@required this.primaryColor,
@required this.primaryColorBrightness,
@required this.accentColor,
@required this.accentColorBrightness,
@required this.canvasColor,
@required this.scaffoldBackgroundColor,
@required this.cardColor,
@required this.dividerColor,
@required this.highlightColor,
@required this.splashColor,
@required this.selectedRowColor,
@required this.unselectedWidgetColor,
@required this.disabledColor,
@required this.buttonColor,
@required this.secondaryHeaderColor,
@required this.textSelectionColor,
@required this.textSelectionHandleColor,
@required this.backgroundColor,
@required this.dialogBackgroundColor,
@required this.indicatorColor,
@required this.hintColor,
@required this.errorColor,
@required this.textTheme,
@required this.primaryTextTheme,
@required this.accentTextTheme,
@required this.iconTheme,
@required this.primaryIconTheme,
@required this.accentIconTheme,
@required this.platform
}) {
assert(brightness != null);
assert(primaryColor != null);
......@@ -222,7 +222,6 @@ class ThemeData {
assert(accentColorBrightness != null);
assert(canvasColor != null);
assert(scaffoldBackgroundColor != null);
assert(dialogBackgroundColor != null);
assert(cardColor != null);
assert(dividerColor != null);
assert(highlightColor != null);
......@@ -234,7 +233,8 @@ class ThemeData {
assert(secondaryHeaderColor != null);
assert(textSelectionColor != null);
assert(textSelectionHandleColor != null);
assert(disabledColor != null);
assert(backgroundColor != null);
assert(dialogBackgroundColor != null);
assert(indicatorColor != null);
assert(hintColor != null);
assert(errorColor != null);
......
......@@ -625,7 +625,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
class _TimePickerDialog extends StatefulWidget {
_TimePickerDialog({
Key key,
this.initialTime
@required this.initialTime
}) : super(key: key) {
assert(initialTime != null);
}
......@@ -793,9 +793,10 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
/// * [showDatePicker]
/// * <https://material.google.com/components/pickers.html#pickers-time-pickers>
Future<TimeOfDay> showTimePicker({
BuildContext context,
TimeOfDay initialTime
@required BuildContext context,
@required TimeOfDay initialTime
}) async {
assert(context != null);
assert(initialTime != null);
return await showDialog(
context: context,
......
......@@ -24,10 +24,10 @@ abstract class RenderToggleable extends RenderConstrainedBox implements Semantic
/// The [value], [activeColor], and [inactiveColor] arguments must not be
/// null.
RenderToggleable({
bool value,
@required bool value,
Size size,
Color activeColor,
Color inactiveColor,
@required Color activeColor,
@required Color inactiveColor,
ValueChanged<bool> onChanged,
@required TickerProvider vsync,
}) : _value = value,
......
......@@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
......@@ -42,12 +43,12 @@ class Tooltip extends StatefulWidget {
/// The [message] argument cannot be null.
Tooltip({
Key key,
this.message,
@required this.message,
this.height: 32.0,
this.padding: const EdgeInsets.symmetric(horizontal: 16.0),
this.verticalOffset: 24.0,
this.preferBelow: true,
this.child,
@required this.child,
}) : super(key: key) {
assert(message != null);
assert(height != null);
......
......@@ -1259,7 +1259,7 @@ class BoxDecoration extends Decoration {
/// An object that paints a [BoxDecoration] into a canvas.
class _BoxDecorationPainter extends BoxPainter {
_BoxDecorationPainter(this._decoration, VoidCallback onChange) : super(onChange) {
_BoxDecorationPainter(@required this._decoration, VoidCallback onChange) : super(onChange) {
assert(_decoration != null);
}
......
......@@ -267,7 +267,7 @@ class RenderCustomMultiChildLayoutBox extends RenderBox
/// The [delegate] argument must not be null.
RenderCustomMultiChildLayoutBox({
List<RenderBox> children,
MultiChildLayoutDelegate delegate
@required MultiChildLayoutDelegate delegate
}) : _delegate = delegate {
assert(delegate != null);
addAll(children);
......
......@@ -180,7 +180,7 @@ class RenderFlow extends RenderBox
/// [isRepaintBounday].
RenderFlow({
List<RenderBox> children,
FlowDelegate delegate
@required FlowDelegate delegate
}) : _delegate = delegate {
assert(delegate != null);
addAll(children);
......
......@@ -613,9 +613,14 @@ class _SemanticsGeometry {
parent.applyPaintTransform(child, transform);
}
}
void updateSemanticsNode({ RenderObject rendering, SemanticsNode semantics, SemanticsNode parentSemantics }) {
void updateSemanticsNode({
@required RenderObject rendering,
@required SemanticsNode semantics,
@required SemanticsNode parentSemantics,
}) {
assert(rendering != null);
assert(semantics != null);
assert(parentSemantics != null);
assert(parentSemantics.wasAffectedByClip != null);
semantics.transform = transform;
if (clipRect != null) {
......@@ -630,7 +635,7 @@ class _SemanticsGeometry {
abstract class _SemanticsFragment {
_SemanticsFragment({
RenderObject renderObjectOwner,
@required RenderObject renderObjectOwner,
this.annotator,
List<_SemanticsFragment> children
}) {
......@@ -670,8 +675,9 @@ abstract class _SemanticsFragment {
/// that comes from the (dirty) ancestors.)
class _CleanSemanticsFragment extends _SemanticsFragment {
_CleanSemanticsFragment({
RenderObject renderObjectOwner
@required RenderObject renderObjectOwner
}) : super(renderObjectOwner: renderObjectOwner) {
assert(renderObjectOwner != null);
assert(renderObjectOwner._semantics != null);
}
......@@ -829,14 +835,18 @@ class _ImplicitSemanticsFragment extends _InterestingSemanticsFragment {
class _ForkingSemanticsFragment extends _SemanticsFragment {
_ForkingSemanticsFragment({
RenderObject renderObjectOwner,
Iterable<_SemanticsFragment> children
@required Iterable<_SemanticsFragment> children
}) : super(renderObjectOwner: renderObjectOwner, children: children) {
assert(children != null);
assert(children.length > 1);
}
@override
Iterable<SemanticsNode> compile({ _SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics }) sync* {
Iterable<SemanticsNode> compile({
@required _SemanticsGeometry geometry,
SemanticsNode currentSemantics,
SemanticsNode parentSemantics
}) sync* {
assert(!_debugCompiled);
assert(() { _debugCompiled = true; return true; });
assert(geometry != null);
......
......@@ -835,7 +835,7 @@ class RenderBackdropFilter extends RenderProxyBox {
/// Creates a backdrop filter.
///
/// The [filter] argument must not be null.
RenderBackdropFilter({ RenderBox child, ui.ImageFilter filter })
RenderBackdropFilter({ RenderBox child, @required ui.ImageFilter filter })
: _filter = filter, super(child) {
assert(filter != null);
}
......@@ -1426,7 +1426,7 @@ class RenderTransform extends RenderProxyBox {
///
/// The [transform] argument must not be null.
RenderTransform({
Matrix4 transform,
@required Matrix4 transform,
Offset origin,
FractionalOffset alignment,
this.transformHitTests: true,
......
......@@ -4,6 +4,7 @@
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:vector_math/vector_math_64.dart';
......@@ -23,7 +24,7 @@ class RenderRotatedBox extends RenderBox with RenderObjectWithChildMixin<RenderB
///
/// The [quarterTurns] argument must not be null.
RenderRotatedBox({
int quarterTurns,
@required int quarterTurns,
RenderBox child
}) : _quarterTurns = quarterTurns {
assert(quarterTurns != null);
......
......@@ -93,7 +93,7 @@ class RenderPadding extends RenderShiftedBox {
///
/// The [padding] argument must not be null and must have non-negative insets.
RenderPadding({
EdgeInsets padding,
@required EdgeInsets padding,
RenderBox child
}) : _padding = padding, super(child) {
assert(padding != null);
......@@ -499,7 +499,7 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox {
/// The [requestedSize] argument must not be null.
RenderSizedOverflowBox({
RenderBox child,
Size requestedSize,
@required Size requestedSize,
FractionalOffset alignment: FractionalOffset.center
}) : _requestedSize = requestedSize,
super(child: child, alignment: alignment) {
......@@ -792,7 +792,7 @@ class RenderCustomSingleChildLayoutBox extends RenderShiftedBox {
/// The [delegate] argument must not be null.
RenderCustomSingleChildLayoutBox({
RenderBox child,
SingleChildLayoutDelegate delegate
@required SingleChildLayoutDelegate delegate
}) : _delegate = delegate, super(child) {
assert(delegate != null);
}
......@@ -901,8 +901,8 @@ class RenderBaseline extends RenderShiftedBox {
/// The [baseline] and [baselineType] arguments must not be null.
RenderBaseline({
RenderBox child,
double baseline,
TextBaseline baselineType
@required double baseline,
@required TextBaseline baselineType
}) : _baseline = baseline,
_baselineType = baselineType,
super(child) {
......
......@@ -29,7 +29,7 @@ class RenderSliverPadding extends RenderSliver with RenderObjectWithChildMixin<R
///
/// The [padding] argument must not be null and must have non-negative insets.
RenderSliverPadding({
EdgeInsets padding,
@required EdgeInsets padding,
RenderSliver child,
}) : _padding = padding {
assert(padding != null);
......
......@@ -489,7 +489,7 @@ class RenderIndexedStack extends RenderStack {
}
@override
bool hitTestChildren(HitTestResult result, { Point position }) {
bool hitTestChildren(HitTestResult result, { @required Point position }) {
if (firstChild == null || index == null)
return false;
assert(position != null);
......
......@@ -15,7 +15,7 @@ class ImageInfo {
/// Creates an [ImageInfo] object for the given image and scale.
///
/// Both the image and the scale must not be null.
ImageInfo({ this.image, this.scale: 1.0 }) {
ImageInfo({ @required this.image, this.scale: 1.0 }) {
assert(image != null);
assert(scale != null);
}
......
......@@ -2314,7 +2314,7 @@ class Flow extends MultiChildRenderObjectWidget {
/// The [delegate] argument must not be null.
Flow.unwrapped({
Key key,
this.delegate,
@required this.delegate,
List<Widget> children: const <Widget>[],
}) : super(key: key, children: children) {
assert(delegate != null);
......
......@@ -128,8 +128,8 @@ class Dismissible extends StatefulWidget {
class _DismissibleClipper extends CustomClipper<Rect> {
_DismissibleClipper({
this.axis,
this.moveAnimation
@required this.axis,
@required this.moveAnimation
}) : super(reclip: moveAnimation) {
assert(axis != null);
assert(moveAnimation != null);
......
......@@ -437,7 +437,7 @@ typedef void _OnDragEnd(Velocity velocity, Offset offset, bool wasAccepted);
// eeding this object pointer events even after it has been disposed.
class _DragAvatar<T> extends Drag {
_DragAvatar({
this.overlayState,
@required this.overlayState,
this.data,
Point initialPosition,
this.dragStartPoint: Point.origin,
......
......@@ -21,7 +21,7 @@ class _FocusScope extends InheritedWidget {
_FocusScope({
Key key,
this.focusState,
this.scopeFocused,
@required this.scopeFocused,
this.focusedScope,
this.focusedWidget,
@required Widget child,
......
......@@ -516,7 +516,7 @@ class AnimatedOpacity extends ImplicitlyAnimatedWidget {
AnimatedOpacity({
Key key,
this.child,
this.opacity,
@required this.opacity,
Curve curve: Curves.linear,
@required Duration duration,
}) : super(key: key, curve: curve, duration: duration) {
......
......@@ -825,7 +825,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
///
/// This can be useful in combination with [removeRouteBelow] when building a
/// non-linear user experience.
void replace({ Route<dynamic> oldRoute, Route<dynamic> newRoute }) {
void replace({ @required Route<dynamic> oldRoute, @required Route<dynamic> newRoute }) {
assert(!_debugLocked);
assert(oldRoute != null);
assert(newRoute != null);
......@@ -919,7 +919,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
/// route must not be the first route in the history.
///
/// In every other way, this acts the same as [replace].
void replaceRouteBelow({ Route<dynamic> anchorRoute, Route<dynamic> newRoute }) {
void replaceRouteBelow({ @required Route<dynamic> anchorRoute, Route<dynamic> newRoute }) {
assert(anchorRoute != null);
assert(anchorRoute._navigator == this);
assert(_history.indexOf(anchorRoute) > 0);
......
......@@ -386,7 +386,7 @@ class OverlayState extends State<Overlay> with TickerProviderStateMixin {
class _Theatre extends RenderObjectWidget {
_Theatre({
this.onstage,
this.offstage,
@required this.offstage,
}) {
assert(offstage != null);
assert(!offstage.any((Widget child) => child == null));
......
......@@ -222,7 +222,7 @@ enum _GlowState { idle, absorb, pull, recede }
class _GlowController extends ChangeNotifier {
_GlowController({
TickerProvider vsync,
@required TickerProvider vsync,
@required Color color,
@required Axis axis,
}) : _color = color,
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'basic.dart';
import 'framework.dart';
......@@ -68,7 +69,7 @@ class PageRouteBuilder<T> extends PageRoute<T> {
/// and [maintainState] arguments must not be null.
PageRouteBuilder({
RouteSettings settings: const RouteSettings(),
this.pageBuilder,
@required this.pageBuilder,
this.transitionsBuilder: _defaultTransitionsBuilder,
this.transitionDuration: const Duration(milliseconds: 300),
this.opaque: true,
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
......@@ -56,7 +57,7 @@ class SizeChangedLayoutNotifier extends SingleChildRenderObjectWidget {
class _RenderSizeChangedWithCallback extends RenderProxyBox {
_RenderSizeChangedWithCallback({
RenderBox child,
this.onLayoutChangedCallback
@required this.onLayoutChangedCallback
}) : super(child) {
assert(onLayoutChangedCallback != null);
}
......
......@@ -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:flutter/foundation.dart';
import 'package:flutter/src/widgets/basic.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/layout_builder.dart';
......@@ -10,7 +11,7 @@ import 'package:flutter_test/flutter_test.dart' hide TypeMatcher;
class Wrapper extends StatelessWidget {
Wrapper({
Key key,
this.child
@required this.child
}) : super(key: key) {
assert(child != null);
}
......
......@@ -4,6 +4,7 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'test_async_utils.dart';
......@@ -135,8 +136,8 @@ class TestGesture {
/// via the `dispatcher` argument.
static Future<TestGesture> down(Point downLocation, {
int pointer: 1,
HitTester hitTester,
EventDispatcher dispatcher
@required HitTester hitTester,
@required EventDispatcher dispatcher,
}) async {
assert(hitTester != null);
assert(dispatcher != null);
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -72,7 +72,7 @@ typedef Future<Null> _Finalizer();
class _FlutterPlatform extends PlatformPlugin {
_FlutterPlatform({
this.shellPath,
@required this.shellPath,
this.collector,
this.debuggerMode,
this.explicitObservatoryPort,
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment