Commit 7be9115a authored by Adam Barth's avatar Adam Barth Committed by GitHub

Deploy `@immutable` in more places (#9462)

Turns out we have many immutable classes.

Fixes #6892
parent 367e11a4
...@@ -52,7 +52,7 @@ class _PointDemoPainter extends CustomPainter { ...@@ -52,7 +52,7 @@ class _PointDemoPainter extends CustomPainter {
}) : _repaint = repaint, super(repaint: repaint); }) : _repaint = repaint, super(repaint: repaint);
final MaterialPointArcTween arc; final MaterialPointArcTween arc;
Animation<double> _repaint; final Animation<double> _repaint;
void drawPoint(Canvas canvas, Offset point, Color color) { void drawPoint(Canvas canvas, Offset point, Color color) {
final Paint paint = new Paint() final Paint paint = new Paint()
...@@ -227,7 +227,7 @@ class _RectangleDemoPainter extends CustomPainter { ...@@ -227,7 +227,7 @@ class _RectangleDemoPainter extends CustomPainter {
}) : _repaint = repaint, super(repaint: repaint); }) : _repaint = repaint, super(repaint: repaint);
final MaterialRectArcTween arc; final MaterialRectArcTween arc;
Animation<double> _repaint; final Animation<double> _repaint;
void drawPoint(Canvas canvas, Offset p, Color color) { void drawPoint(Canvas canvas, Offset p, Color color) {
final Paint paint = new Paint() final Paint paint = new Paint()
......
...@@ -4,11 +4,14 @@ ...@@ -4,11 +4,14 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/foundation.dart';
/// A mapping of the unit interval to the unit interval. /// A mapping of the unit interval to the unit interval.
/// ///
/// A curve must map t=0.0 to 0.0 and t=1.0 to 1.0. /// A curve must map t=0.0 to 0.0 and t=1.0 to 1.0.
/// ///
/// See [Curves] for a collection of common animation curves. /// See [Curves] for a collection of common animation curves.
@immutable
abstract class Curve { abstract class Curve {
/// Abstract const constructor. This constructor enables subclasses to provide /// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions. /// const constructors so that they can be used in const expressions.
......
...@@ -69,6 +69,7 @@ int nthMouseButton(int number) => (kPrimaryMouseButton << (number - 1)) & kMaxUn ...@@ -69,6 +69,7 @@ int nthMouseButton(int number) => (kPrimaryMouseButton << (number - 1)) & kMaxUn
int nthStylusButton(int number) => (kPrimaryStylusButton << (number - 1)) & kMaxUnsignedSMI; int nthStylusButton(int number) => (kPrimaryStylusButton << (number - 1)) & kMaxUnsignedSMI;
/// Base class for touch, stylus, or mouse events. /// Base class for touch, stylus, or mouse events.
@immutable
abstract class PointerEvent { abstract class PointerEvent {
/// Abstract const constructor. This constructor enables subclasses to provide /// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions. /// const constructors so that they can be used in const expressions.
......
...@@ -30,6 +30,7 @@ typedef void DataColumnSortCallback(int columnIndex, bool ascending); ...@@ -30,6 +30,7 @@ typedef void DataColumnSortCallback(int columnIndex, bool ascending);
/// One column configuration must be provided for each column to /// One column configuration must be provided for each column to
/// display in the table. The list of [DataColumn] objects is passed /// display in the table. The list of [DataColumn] objects is passed
/// as the `columns` argument to the [new DataTable] constructor. /// as the `columns` argument to the [new DataTable] constructor.
@immutable
class DataColumn { class DataColumn {
/// Creates the configuration for a column of a [DataTable]. /// Creates the configuration for a column of a [DataTable].
/// ///
...@@ -81,6 +82,7 @@ class DataColumn { ...@@ -81,6 +82,7 @@ class DataColumn {
/// ///
/// The data for this row of the table is provided in the [cells] /// The data for this row of the table is provided in the [cells]
/// property of the [DataRow] object. /// property of the [DataRow] object.
@immutable
class DataRow { class DataRow {
/// Creates the configuration for a row of a [DataTable]. /// Creates the configuration for a row of a [DataTable].
/// ///
...@@ -150,6 +152,7 @@ class DataRow { ...@@ -150,6 +152,7 @@ class DataRow {
/// One list of [DataCell] objects must be provided for each [DataRow] /// One list of [DataCell] objects must be provided for each [DataRow]
/// in the [DataTable], in the [new DataRow] constructor's `cells` /// in the [DataTable], in the [new DataRow] constructor's `cells`
/// argument. /// argument.
@immutable
class DataCell { class DataCell {
/// Creates an object to hold the data for a cell in a [DataTable]. /// Creates an object to hold the data for a cell in a [DataTable].
/// ///
......
...@@ -2,9 +2,12 @@ ...@@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/foundation.dart';
/// A description of a material design icon. /// A description of a material design icon.
/// ///
/// See [Icons] for a number of predefined icons. /// See [Icons] for a number of predefined icons.
@immutable
class IconData { class IconData {
/// Creates icon data. /// Creates icon data.
/// ///
......
...@@ -23,6 +23,7 @@ const Curve _kTransitionCurve = Curves.fastOutSlowIn; ...@@ -23,6 +23,7 @@ const Curve _kTransitionCurve = Curves.fastOutSlowIn;
/// [InputDecoration]. /// [InputDecoration].
/// * [InputDecorator], which is a widget that draws an [InputDecoration] /// * [InputDecorator], which is a widget that draws an [InputDecoration]
/// around an arbitrary child widget. /// around an arbitrary child widget.
@immutable
class InputDecoration { class InputDecoration {
/// Creates a bundle of text and styles used to label an input field. /// Creates a bundle of text and styles used to label an input field.
/// ///
......
...@@ -119,7 +119,6 @@ class ListTileTheme extends InheritedWidget { ...@@ -119,7 +119,6 @@ class ListTileTheme extends InheritedWidget {
} }
} }
/// A single fixed-height row that typically contains some text as well as /// A single fixed-height row that typically contains some text as well as
/// a leading or trailing icon. /// a leading or trailing icon.
/// ///
......
...@@ -11,6 +11,7 @@ import 'package:flutter/rendering.dart'; ...@@ -11,6 +11,7 @@ import 'package:flutter/rendering.dart';
/// The base type for [MaterialSlice] and [MaterialGap]. /// The base type for [MaterialSlice] and [MaterialGap].
/// ///
/// All [MergeableMaterialItem] objects need a [LocalKey]. /// All [MergeableMaterialItem] objects need a [LocalKey].
@immutable
abstract class MergeableMaterialItem { abstract class MergeableMaterialItem {
/// Abstract const constructor. This constructor enables subclasses to provide /// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions. /// const constructors so that they can be used in const expressions.
......
...@@ -30,12 +30,16 @@ import 'typography.dart'; ...@@ -30,12 +30,16 @@ import 'typography.dart';
enum StepState { enum StepState {
/// A step that displays its index in its circle. /// A step that displays its index in its circle.
indexed, indexed,
/// A step that displays a pencil icon in its circle. /// A step that displays a pencil icon in its circle.
editing, editing,
/// A step that displays a tick icon in its circle. /// A step that displays a tick icon in its circle.
complete, complete,
/// A step that is disabled and does not to react to taps. /// A step that is disabled and does not to react to taps.
disabled, disabled,
/// A step that is currently having an error. e.g. the use has submitted wrong /// A step that is currently having an error. e.g. the use has submitted wrong
/// input. /// input.
error, error,
...@@ -45,6 +49,7 @@ enum StepState { ...@@ -45,6 +49,7 @@ enum StepState {
enum StepperType { enum StepperType {
/// A vertical layout of the steps with their content in-between the titles. /// A vertical layout of the steps with their content in-between the titles.
vertical, vertical,
/// A horizontal layout of the steps with their content below the titles. /// A horizontal layout of the steps with their content below the titles.
horizontal, horizontal,
} }
...@@ -70,6 +75,7 @@ const double _kTriangleHeight = _kStepSize * 0.866025; // Traingle height. sqrt( ...@@ -70,6 +75,7 @@ const double _kTriangleHeight = _kStepSize * 0.866025; // Traingle height. sqrt(
/// ///
/// * [Stepper] /// * [Stepper]
/// * <https://material.google.com/components/steppers.html> /// * <https://material.google.com/components/steppers.html>
@immutable
class Step { class Step {
/// Creates a step for a [Stepper]. /// Creates a step for a [Stepper].
/// ///
......
...@@ -47,6 +47,7 @@ const Color _kDarkThemeSplashColor = const Color(0x40CCCCCC); ...@@ -47,6 +47,7 @@ const Color _kDarkThemeSplashColor = const Color(0x40CCCCCC);
/// Use this class to configure a [Theme] widget. /// Use this class to configure a [Theme] widget.
/// ///
/// To obtain the current theme, use [Theme.of]. /// To obtain the current theme, use [Theme.of].
@immutable
class ThemeData { class ThemeData {
/// Create a ThemeData given a set of preferred values. /// Create a ThemeData given a set of preferred values.
/// ///
......
...@@ -34,6 +34,7 @@ enum DayPeriod { ...@@ -34,6 +34,7 @@ enum DayPeriod {
} }
/// A value representing a time during the day /// A value representing a time during the day
@immutable
class TimeOfDay { class TimeOfDay {
/// Creates a time of day. /// Creates a time of day.
/// ///
......
...@@ -26,6 +26,7 @@ import 'colors.dart'; ...@@ -26,6 +26,7 @@ import 'colors.dart';
/// * [Theme] /// * [Theme]
/// * [ThemeData] /// * [ThemeData]
/// * <http://material.google.com/style/typography.html> /// * <http://material.google.com/style/typography.html>
@immutable
class TextTheme { class TextTheme {
/// Create a text theme that uses the given values. /// Create a text theme that uses the given values.
/// ///
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'basic_types.dart'; import 'basic_types.dart';
/// How a box should be inscribed into another box. /// How a box should be inscribed into another box.
...@@ -40,6 +42,7 @@ enum BoxFit { ...@@ -40,6 +42,7 @@ enum BoxFit {
} }
/// The pair of sizes returned by [applyBoxFit]. /// The pair of sizes returned by [applyBoxFit].
@immutable
class FittedSizes { class FittedSizes {
/// Creates an object to store a pair of sizes, /// Creates an object to store a pair of sizes,
/// as would be returned by [applyBoxFit]. /// as would be returned by [applyBoxFit].
......
...@@ -529,6 +529,8 @@ class BoxParentData extends ParentData { ...@@ -529,6 +529,8 @@ class BoxParentData extends ParentData {
abstract class ContainerBoxParentDataMixin<ChildType extends RenderObject> extends BoxParentData with ContainerParentDataMixin<ChildType> { } abstract class ContainerBoxParentDataMixin<ChildType extends RenderObject> extends BoxParentData with ContainerParentDataMixin<ChildType> { }
enum _IntrinsicDimension { minWidth, maxWidth, minHeight, maxHeight } enum _IntrinsicDimension { minWidth, maxWidth, minHeight, maxHeight }
@immutable
class _IntrinsicDimensionsCacheEntry { class _IntrinsicDimensionsCacheEntry {
_IntrinsicDimensionsCacheEntry(this.dimension, this.argument); _IntrinsicDimensionsCacheEntry(this.dimension, this.argument);
......
...@@ -27,6 +27,7 @@ typedef void SelectionChangedHandler(TextSelection selection, RenderEditable ren ...@@ -27,6 +27,7 @@ typedef void SelectionChangedHandler(TextSelection selection, RenderEditable ren
/// Represents a global screen coordinate of the point in a selection, and the /// Represents a global screen coordinate of the point in a selection, and the
/// text direction at that point. /// text direction at that point.
@immutable
class TextSelectionPoint { class TextSelectionPoint {
/// Creates a description of a point in a text selection. /// Creates a description of a point in a text selection.
/// ///
......
...@@ -55,6 +55,7 @@ typedef bool SemanticsNodeVisitor(SemanticsNode node); ...@@ -55,6 +55,7 @@ typedef bool SemanticsNodeVisitor(SemanticsNode node);
/// for the node. /// for the node.
/// ///
/// Typically obtained from [SemanticsNode.getSemanticsData]. /// Typically obtained from [SemanticsNode.getSemanticsData].
@immutable
class SemanticsData { class SemanticsData {
/// Creates a semantics data object. /// Creates a semantics data object.
/// ///
......
...@@ -19,6 +19,7 @@ import 'object.dart'; ...@@ -19,6 +19,7 @@ import 'object.dart';
/// ///
/// If you create the RelativeRect with null values, the methods on /// If you create the RelativeRect with null values, the methods on
/// RelativeRect will not work usefully (or at all). /// RelativeRect will not work usefully (or at all).
@immutable
class RelativeRect { class RelativeRect {
/// Creates a RelativeRect with the given values. /// Creates a RelativeRect with the given values.
const RelativeRect.fromLTRB(this.left, this.top, this.right, this.bottom); const RelativeRect.fromLTRB(this.left, this.top, this.right, this.bottom);
...@@ -204,6 +205,7 @@ class StackParentData extends ContainerBoxParentDataMixin<RenderBox> { ...@@ -204,6 +205,7 @@ class StackParentData extends ContainerBoxParentDataMixin<RenderBox> {
enum Overflow { enum Overflow {
/// Overflowing children will be visible. /// Overflowing children will be visible.
visible, visible,
/// Overflowing children will be clipped to the bounds of their parent. /// Overflowing children will be clipped to the bounds of their parent.
clip, clip,
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'dart:collection'; import 'dart:collection';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'box.dart'; import 'box.dart';
import 'object.dart'; import 'object.dart';
...@@ -32,6 +34,7 @@ class TableCellParentData extends BoxParentData { ...@@ -32,6 +34,7 @@ class TableCellParentData extends BoxParentData {
/// distributes the space equally among the flexible columns, /// distributes the space equally among the flexible columns,
/// [FractionColumnWidth], which sizes a column based on the size of the /// [FractionColumnWidth], which sizes a column based on the size of the
/// table's container. /// table's container.
@immutable
abstract class TableColumnWidth { abstract class TableColumnWidth {
/// Abstract const constructor. This constructor enables subclasses to provide /// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions. /// const constructors so that they can be used in const expressions.
......
...@@ -6,6 +6,7 @@ import 'dart:developer'; ...@@ -6,6 +6,7 @@ import 'dart:developer';
import 'dart:io' show Platform; import 'dart:io' show Platform;
import 'dart:ui' as ui show Scene, SceneBuilder, window; import 'dart:ui' as ui show Scene, SceneBuilder, window;
import 'package:flutter/foundation.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
import 'binding.dart'; import 'binding.dart';
...@@ -15,6 +16,7 @@ import 'layer.dart'; ...@@ -15,6 +16,7 @@ import 'layer.dart';
import 'object.dart'; import 'object.dart';
/// The layout constraints for the root render object. /// The layout constraints for the root render object.
@immutable
class ViewConfiguration { class ViewConfiguration {
/// Creates a view configuration. /// Creates a view configuration.
/// ///
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/foundation.dart';
/// A task priority, as passed to [SchedulerBinding.scheduleTask]. /// A task priority, as passed to [SchedulerBinding.scheduleTask].
@immutable
class Priority { class Priority {
const Priority._(this._value); const Priority._(this._value);
......
...@@ -4,12 +4,15 @@ ...@@ -4,12 +4,15 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/foundation.dart';
import 'system_channels.dart'; import 'system_channels.dart';
/// Data stored on the system clipboard. /// Data stored on the system clipboard.
/// ///
/// The system clipboard can contain data of various media types. This data /// The system clipboard can contain data of various media types. This data
/// structure currently supports only plain text data, in the [text] property. /// structure currently supports only plain text data, in the [text] property.
@immutable
class ClipboardData { class ClipboardData {
/// Creates data for the system clipboard. /// Creates data for the system clipboard.
const ClipboardData({ this.text }); const ClipboardData({ this.text });
......
...@@ -19,6 +19,7 @@ import 'image_stream.dart'; ...@@ -19,6 +19,7 @@ import 'image_stream.dart';
/// Configuration information passed to the [ImageProvider.resolve] method to /// Configuration information passed to the [ImageProvider.resolve] method to
/// select a specific image. /// select a specific image.
@immutable
class ImageConfiguration { class ImageConfiguration {
/// Creates an object holding the configuration information for an [ImageProvider]. /// Creates an object holding the configuration information for an [ImageProvider].
/// ///
...@@ -212,6 +213,7 @@ abstract class ImageProvider<T> { ...@@ -212,6 +213,7 @@ abstract class ImageProvider<T> {
/// Key for the image obtained by an [AssetImage] or [ExactAssetImage]. /// Key for the image obtained by an [AssetImage] or [ExactAssetImage].
/// ///
/// This is used to identify the precise resource in the [imageCache]. /// This is used to identify the precise resource in the [imageCache].
@immutable
class AssetBundleImageKey { class AssetBundleImageKey {
/// Creates the key for an [AssetImage] or [AssetBundleImageProvider]. /// Creates the key for an [AssetImage] or [AssetBundleImageProvider].
/// ///
......
...@@ -11,6 +11,7 @@ import 'package:flutter/foundation.dart'; ...@@ -11,6 +11,7 @@ import 'package:flutter/foundation.dart';
/// ///
/// ImageInfo objects are used by [ImageStream] objects to represent the /// ImageInfo objects are used by [ImageStream] objects to represent the
/// actual data of the image once it has been obtained. /// actual data of the image once it has been obtained.
@immutable
class ImageInfo { class ImageInfo {
/// Creates an [ImageInfo] object for the given image and scale. /// Creates an [ImageInfo] object for the given image and scale.
/// ///
......
...@@ -28,6 +28,7 @@ abstract class MessageCodec<T> { ...@@ -28,6 +28,7 @@ abstract class MessageCodec<T> {
} }
/// An command object representing the invocation of a named method. /// An command object representing the invocation of a named method.
@immutable
class MethodCall { class MethodCall {
/// Creates a [MethodCall] representing the invocation of [method] with the /// Creates a [MethodCall] representing the invocation of [method] with the
/// specified [arguments]. /// specified [arguments].
......
...@@ -20,6 +20,7 @@ import 'system_channels.dart'; ...@@ -20,6 +20,7 @@ import 'system_channels.dart';
/// * [RawKeyEvent] /// * [RawKeyEvent]
/// * [RawKeyDownEvent] /// * [RawKeyDownEvent]
/// * [RawKeyUpEvent] /// * [RawKeyUpEvent]
@immutable
abstract class RawKeyEventData { abstract class RawKeyEventData {
/// Abstract const constructor. This constructor enables subclasses to provide /// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions. /// const constructors so that they can be used in const expressions.
...@@ -101,6 +102,7 @@ class RawKeyEventDataFuchsia extends RawKeyEventData { ...@@ -101,6 +102,7 @@ class RawKeyEventDataFuchsia extends RawKeyEventData {
/// * [RawKeyDownEvent] /// * [RawKeyDownEvent]
/// * [RawKeyUpEvent] /// * [RawKeyUpEvent]
/// * [RawKeyboardListener], a widget that listens for raw key events. /// * [RawKeyboardListener], a widget that listens for raw key events.
@immutable
abstract class RawKeyEvent { abstract class RawKeyEvent {
/// Initializes fields for subclasses. /// Initializes fields for subclasses.
const RawKeyEvent({ const RawKeyEvent({
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/foundation.dart';
import 'system_channels.dart'; import 'system_channels.dart';
/// Specifies a particular device orientation. /// Specifies a particular device orientation.
...@@ -47,6 +49,7 @@ enum DeviceOrientation { ...@@ -47,6 +49,7 @@ enum DeviceOrientation {
/// interface. /// interface.
/// ///
/// Used by [SystemChrome.setApplicationSwitcherDescription]. /// Used by [SystemChrome.setApplicationSwitcherDescription].
@immutable
class ApplicationSwitcherDescription { class ApplicationSwitcherDescription {
/// Creates an ApplicationSwitcherDescription. /// Creates an ApplicationSwitcherDescription.
const ApplicationSwitcherDescription({ this.label, this.primaryColor }); const ApplicationSwitcherDescription({ this.label, this.primaryColor });
......
...@@ -9,6 +9,7 @@ import 'package:flutter/foundation.dart'; ...@@ -9,6 +9,7 @@ import 'package:flutter/foundation.dart';
export 'dart:ui' show TextAffinity, TextPosition; export 'dart:ui' show TextAffinity, TextPosition;
/// A range of characters in a string of text. /// A range of characters in a string of text.
@immutable
class TextRange { class TextRange {
/// Creates a text range. /// Creates a text range.
/// ///
...@@ -89,6 +90,7 @@ class TextRange { ...@@ -89,6 +90,7 @@ class TextRange {
} }
/// A range of text that represents a selection. /// A range of text that represents a selection.
@immutable
class TextSelection extends TextRange { class TextSelection extends TextRange {
/// Creates a text selection. /// Creates a text selection.
/// ///
......
...@@ -39,6 +39,7 @@ enum TextInputAction { ...@@ -39,6 +39,7 @@ enum TextInputAction {
/// See also: /// See also:
/// ///
/// * [TextInput.attach] /// * [TextInput.attach]
@immutable
class TextInputConfiguration { class TextInputConfiguration {
/// Creates configuration information for a text input control. /// Creates configuration information for a text input control.
/// ///
...@@ -74,6 +75,7 @@ TextAffinity _toTextAffinity(String affinity) { ...@@ -74,6 +75,7 @@ TextAffinity _toTextAffinity(String affinity) {
} }
/// The current text, selection, and composing state for editing a run of text. /// The current text, selection, and composing state for editing a run of text.
@immutable
class TextEditingValue { class TextEditingValue {
/// Creates information for editing a run of text. /// Creates information for editing a run of text.
/// ///
......
...@@ -18,6 +18,7 @@ enum CrossFadeState { ...@@ -18,6 +18,7 @@ enum CrossFadeState {
/// Show the first child ([AnimatedCrossFade.firstChild]) and hide the second /// Show the first child ([AnimatedCrossFade.firstChild]) and hide the second
/// ([AnimatedCrossFade.secondChild]]). /// ([AnimatedCrossFade.secondChild]]).
showFirst, showFirst,
/// Show the second child ([AnimatedCrossFade.secondChild]) and hide the first /// Show the second child ([AnimatedCrossFade.secondChild]) and hide the first
/// ([AnimatedCrossFade.firstChild]). /// ([AnimatedCrossFade.firstChild]).
showSecond, showSecond,
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
import 'dart:async' show Future, Stream, StreamSubscription; import 'dart:async' show Future, Stream, StreamSubscription;
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart' show required; import 'package:meta/meta.dart' show required;
...@@ -182,6 +183,7 @@ enum ConnectionState { ...@@ -182,6 +183,7 @@ enum ConnectionState {
/// with a [Stream]. /// with a [Stream].
/// * [FutureBuilder], which builds itself based on a snapshot from interacting /// * [FutureBuilder], which builds itself based on a snapshot from interacting
/// with a [Future]. /// with a [Future].
@immutable
class AsyncSnapshot<T> { class AsyncSnapshot<T> {
/// Creates an [AsyncSnapshot] with the specified [connectionState], /// Creates an [AsyncSnapshot] with the specified [connectionState],
/// and optionally either [data] or [error] (but not both). /// and optionally either [data] or [error] (but not both).
......
...@@ -27,6 +27,7 @@ export 'package:flutter/rendering.dart' show RenderObject, RenderBox, debugDumpR ...@@ -27,6 +27,7 @@ export 'package:flutter/rendering.dart' show RenderObject, RenderBox, debugDumpR
/// Keys must be unique amongst the [Element]s with the same parent. /// Keys must be unique amongst the [Element]s with the same parent.
/// ///
/// Subclasses of [Key] should either subclass [LocalKey] or [GlobalKey]. /// Subclasses of [Key] should either subclass [LocalKey] or [GlobalKey].
@immutable
abstract class Key { abstract class Key {
/// Construct a [ValueKey<String>] with the given [String]. /// Construct a [ValueKey<String>] with the given [String].
/// ///
......
...@@ -26,6 +26,7 @@ enum Orientation { ...@@ -26,6 +26,7 @@ enum Orientation {
/// To obtain the current [MediaQueryData] for a given [BuildContext], use the /// To obtain the current [MediaQueryData] for a given [BuildContext], use the
/// [MediaQuery.of] function. For example, to obtain the size of the current /// [MediaQuery.of] function. For example, to obtain the size of the current
/// window, use `MediaQuery.of(context).size`. /// window, use `MediaQuery.of(context).size`.
@immutable
class MediaQueryData { class MediaQueryData {
/// Creates data for a media query with explicit values. /// Creates data for a media query with explicit values.
/// ///
......
...@@ -192,6 +192,7 @@ abstract class Route<T> { ...@@ -192,6 +192,7 @@ abstract class Route<T> {
} }
/// Data that might be useful in constructing a [Route]. /// Data that might be useful in constructing a [Route].
@immutable
class RouteSettings { class RouteSettings {
/// Creates data used to construct routes. /// Creates data used to construct routes.
const RouteSettings({ const RouteSettings({
...@@ -377,6 +378,7 @@ typedef bool RoutePredicate(Route<dynamic> route); ...@@ -377,6 +378,7 @@ typedef bool RoutePredicate(Route<dynamic> route);
/// ``` /// ```
/// ///
/// To show a route by name: /// To show a route by name:
///
/// ```dart /// ```dart
/// Navigator.of(context).pushNamed('/b'); /// Navigator.of(context).pushNamed('/b');
/// ``` /// ```
...@@ -462,6 +464,7 @@ typedef bool RoutePredicate(Route<dynamic> route); ...@@ -462,6 +464,7 @@ typedef bool RoutePredicate(Route<dynamic> route);
/// } /// }
/// )); /// ));
/// ``` /// ```
///
/// The page route is built in two parts, the "page" and the /// The page route is built in two parts, the "page" and the
/// "transitions". The page becomes a descendant of the child passed to /// "transitions". The page becomes a descendant of the child passed to
/// the `buildTransitions` method. Typically the page is only built once, /// the `buildTransitions` method. Typically the page is only built once,
......
...@@ -15,6 +15,7 @@ const Color _kDefaultGlowColor = const Color(0xFFFFFFFF); ...@@ -15,6 +15,7 @@ const Color _kDefaultGlowColor = const Color(0xFFFFFFFF);
/// ///
/// Used by [ScrollConfiguration] to configure the [Scrollable] widgets in a /// Used by [ScrollConfiguration] to configure the [Scrollable] widgets in a
/// subtree. /// subtree.
@immutable
class ScrollBehavior { class ScrollBehavior {
/// Creates a description of how [Scrollable] widgets should behave. /// Creates a description of how [Scrollable] widgets should behave.
const ScrollBehavior(); const ScrollBehavior();
......
...@@ -18,6 +18,7 @@ import 'scrollable.dart' show Scrollable, ScrollableState; ...@@ -18,6 +18,7 @@ import 'scrollable.dart' show Scrollable, ScrollableState;
/// not defined, but must be consistent. For example, they could be in pixels, /// not defined, but must be consistent. For example, they could be in pixels,
/// or in percentages, or in units of the [extentInside] (in the latter case, /// or in percentages, or in units of the [extentInside] (in the latter case,
/// [extentInside] would always be 1.0). /// [extentInside] would always be 1.0).
@immutable
class ScrollMetrics { class ScrollMetrics {
/// Create a description of the metrics of a [Scrollable]'s contents. /// Create a description of the metrics of a [Scrollable]'s contents.
/// ///
......
...@@ -32,6 +32,7 @@ abstract class AbstractScrollState { ...@@ -32,6 +32,7 @@ abstract class AbstractScrollState {
void dispatchNotification(Notification notification); void dispatchNotification(Notification notification);
} }
@immutable
abstract class ScrollPhysics { abstract class ScrollPhysics {
const ScrollPhysics(this.parent); const ScrollPhysics(this.parent);
......
...@@ -28,6 +28,7 @@ export 'package:flutter/rendering.dart' show ...@@ -28,6 +28,7 @@ export 'package:flutter/rendering.dart' show
/// ///
/// The alignment of individual cells in a row can be controlled using a /// The alignment of individual cells in a row can be controlled using a
/// [TableCell]. /// [TableCell].
@immutable
class TableRow { class TableRow {
/// Creates a row in a [Table]. /// Creates a row in a [Table].
const TableRow({ this.key, this.decoration, this.children }); const TableRow({ this.key, this.decoration, this.children });
......
...@@ -26,7 +26,7 @@ export 'src/widgets/focus_scope.dart'; ...@@ -26,7 +26,7 @@ export 'src/widgets/focus_scope.dart';
export 'src/widgets/form.dart'; export 'src/widgets/form.dart';
export 'src/widgets/framework.dart'; export 'src/widgets/framework.dart';
export 'src/widgets/gesture_detector.dart'; export 'src/widgets/gesture_detector.dart';
export 'src/widgets/gridpaper.dart'; export 'src/widgets/grid_paper.dart';
export 'src/widgets/heroes.dart'; export 'src/widgets/heroes.dart';
export 'src/widgets/image.dart'; export 'src/widgets/image.dart';
export 'src/widgets/implicit_animations.dart'; export 'src/widgets/implicit_animations.dart';
......
...@@ -36,7 +36,7 @@ List<BoxShadow> getShadow(WidgetTester tester) { ...@@ -36,7 +36,7 @@ List<BoxShadow> getShadow(WidgetTester tester) {
class PaintRecorder extends CustomPainter { class PaintRecorder extends CustomPainter {
PaintRecorder(this.log); PaintRecorder(this.log);
List<Size> log; final List<Size> log;
@override @override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
......
...@@ -8,8 +8,8 @@ import 'package:flutter/widgets.dart'; ...@@ -8,8 +8,8 @@ import 'package:flutter/widgets.dart';
class TestCustomPainter extends CustomPainter { class TestCustomPainter extends CustomPainter {
TestCustomPainter({ this.log, this.name }); TestCustomPainter({ this.log, this.name });
List<String> log; final List<String> log;
String name; final String name;
@override @override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
......
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