Declare locals final where not reassigned (layers) (#8572)

diff --git a/examples/layers/raw/canvas.dart b/examples/layers/raw/canvas.dart
index 423f540..ec96f1e 100644
--- a/examples/layers/raw/canvas.dart
+++ b/examples/layers/raw/canvas.dart
@@ -13,21 +13,21 @@
   // First we create a PictureRecorder to record the commands we're going to
   // feed in the canvas. The PictureRecorder will eventually produce a Picture,
   // which is an immutable record of those commands.
-  ui.PictureRecorder recorder = new ui.PictureRecorder();
+  final ui.PictureRecorder recorder = new ui.PictureRecorder();
 
   // Next, we create a canvas from the recorder. The canvas is an interface
   // which can receive drawing commands. The canvas interface is modeled after
   // the SkCanvas interface from Skia. The paintBounds establishes a "cull rect"
   // for the canvas, which lets the implementation discard any commands that
   // are entirely outside this rectangle.
-  ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
+  final ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
 
-  ui.Paint paint = new ui.Paint();
+  final ui.Paint paint = new ui.Paint();
   canvas.drawPaint(new ui.Paint()..color = const ui.Color(0xFFFFFFFF));
 
-  ui.Size size = paintBounds.size;
-  ui.Point mid = size.center(ui.Point.origin);
-  double radius = size.shortestSide / 2.0;
+  final ui.Size size = paintBounds.size;
+  final ui.Point mid = size.center(ui.Point.origin);
+  final double radius = size.shortestSide / 2.0;
 
   final double devicePixelRatio = ui.window.devicePixelRatio;
   final ui.Size logicalSize = ui.window.physicalSize / devicePixelRatio;
@@ -41,7 +41,7 @@
   paint.color = const ui.Color.fromARGB(128, 255, 0, 255);
   canvas.rotate(math.PI/4.0);
 
-  ui.Gradient yellowBlue = new ui.Gradient.linear(
+  final ui.Gradient yellowBlue = new ui.Gradient.linear(
     <ui.Point>[new ui.Point(-radius, -radius), const ui.Point(0.0, 0.0)],
     <ui.Color>[const ui.Color(0xFFFFFF00), const ui.Color(0xFF0000FF)]
   );
@@ -49,7 +49,7 @@
                   new ui.Paint()..shader = yellowBlue);
 
   // Scale x and y by 0.5.
-  Float64List scaleMatrix = new Float64List.fromList(<double>[
+  final Float64List scaleMatrix = new Float64List.fromList(<double>[
       0.5, 0.0, 0.0, 0.0,
       0.0, 0.5, 0.0, 0.0,
       0.0, 0.0, 1.0, 0.0,
@@ -72,12 +72,12 @@
 
 ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
   final double devicePixelRatio = ui.window.devicePixelRatio;
-  Float64List deviceTransform = new Float64List(16)
+  final Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
     ..[10] = 1.0
     ..[15] = 1.0;
-  ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
+  final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
     ..pushTransform(deviceTransform)
     ..addPicture(ui.Offset.zero, picture)
     ..pop();
@@ -85,9 +85,9 @@
 }
 
 void beginFrame(Duration timeStamp) {
-  ui.Rect paintBounds = ui.Point.origin & (ui.window.physicalSize / ui.window.devicePixelRatio);
-  ui.Picture picture = paint(paintBounds);
-  ui.Scene scene = composite(picture, paintBounds);
+  final ui.Rect paintBounds = ui.Point.origin & (ui.window.physicalSize / ui.window.devicePixelRatio);
+  final ui.Picture picture = paint(paintBounds);
+  final ui.Scene scene = composite(picture, paintBounds);
   ui.window.render(scene);
 }
 
diff --git a/examples/layers/raw/spinning_square.dart b/examples/layers/raw/spinning_square.dart
index cae6eb0..0a18f93 100644
--- a/examples/layers/raw/spinning_square.dart
+++ b/examples/layers/raw/spinning_square.dart
@@ -19,29 +19,29 @@
 
   // PAINT
 
-  ui.Rect paintBounds = ui.Point.origin & (ui.window.physicalSize / ui.window.devicePixelRatio);
-  ui.PictureRecorder recorder = new ui.PictureRecorder();
-  ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
+  final ui.Rect paintBounds = ui.Point.origin & (ui.window.physicalSize / ui.window.devicePixelRatio);
+  final ui.PictureRecorder recorder = new ui.PictureRecorder();
+  final ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
   canvas.translate(paintBounds.width / 2.0, paintBounds.height / 2.0);
 
   // Here we determine the rotation according to the timeStamp given to us by
   // the engine.
-  double t = timeStamp.inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND / 1800.0;
+  final double t = timeStamp.inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND / 1800.0;
   canvas.rotate(math.PI * (t % 1.0));
 
   canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
                   new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
-  ui.Picture picture = recorder.endRecording();
+  final ui.Picture picture = recorder.endRecording();
 
   // COMPOSITE
 
   final double devicePixelRatio = ui.window.devicePixelRatio;
-  Float64List deviceTransform = new Float64List(16)
+  final Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
     ..[10] = 1.0
     ..[15] = 1.0;
-  ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
+  final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
     ..pushTransform(deviceTransform)
     ..addPicture(ui.Offset.zero, picture)
     ..pop();
diff --git a/examples/layers/raw/text.dart b/examples/layers/raw/text.dart
index a35b0ab..086208d 100644
--- a/examples/layers/raw/text.dart
+++ b/examples/layers/raw/text.dart
@@ -12,8 +12,8 @@
 ui.Paragraph paragraph;
 
 ui.Picture paint(ui.Rect paintBounds) {
-  ui.PictureRecorder recorder = new ui.PictureRecorder();
-  ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
+  final ui.PictureRecorder recorder = new ui.PictureRecorder();
+  final ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
 
   final double devicePixelRatio = ui.window.devicePixelRatio;
   final ui.Size logicalSize = ui.window.physicalSize / devicePixelRatio;
@@ -31,12 +31,12 @@
 
 ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
   final double devicePixelRatio = ui.window.devicePixelRatio;
-  Float64List deviceTransform = new Float64List(16)
+  final Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
     ..[10] = 1.0
     ..[15] = 1.0;
-  ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
+  final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
     ..pushTransform(deviceTransform)
     ..addPicture(ui.Offset.zero, picture)
     ..pop();
@@ -44,15 +44,15 @@
 }
 
 void beginFrame(Duration timeStamp) {
-  ui.Rect paintBounds = ui.Point.origin & (ui.window.physicalSize / ui.window.devicePixelRatio);
-  ui.Picture picture = paint(paintBounds);
-  ui.Scene scene = composite(picture, paintBounds);
+  final ui.Rect paintBounds = ui.Point.origin & (ui.window.physicalSize / ui.window.devicePixelRatio);
+  final ui.Picture picture = paint(paintBounds);
+  final ui.Scene scene = composite(picture, paintBounds);
   ui.window.render(scene);
 }
 
 void main() {
   // To create a paragraph of text, we use ParagraphBuilder.
-  ui.ParagraphBuilder builder = new ui.ParagraphBuilder(new ui.ParagraphStyle())
+  final ui.ParagraphBuilder builder = new ui.ParagraphBuilder(new ui.ParagraphStyle())
     // We first push a style that turns the text blue.
     ..pushStyle(new ui.TextStyle(color: const ui.Color(0xFF0000FF)))
     ..addText('Hello, ')
diff --git a/examples/layers/raw/touch_input.dart b/examples/layers/raw/touch_input.dart
index 24b5735..a8f7d9e 100644
--- a/examples/layers/raw/touch_input.dart
+++ b/examples/layers/raw/touch_input.dart
@@ -14,17 +14,17 @@
   // First we create a PictureRecorder to record the commands we're going to
   // feed in the canvas. The PictureRecorder will eventually produce a Picture,
   // which is an immutable record of those commands.
-  ui.PictureRecorder recorder = new ui.PictureRecorder();
+  final ui.PictureRecorder recorder = new ui.PictureRecorder();
 
   // Next, we create a canvas from the recorder. The canvas is an interface
   // which can receive drawing commands. The canvas interface is modeled after
   // the SkCanvas interface from Skia. The paintBounds establishes a "cull rect"
   // for the canvas, which lets the implementation discard any commands that
   // are entirely outside this rectangle.
-  ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
+  final ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
 
   // The commands draw a circle in the center of the screen.
-  ui.Size size = paintBounds.size;
+  final ui.Size size = paintBounds.size;
   canvas.drawCircle(
     size.center(ui.Point.origin),
     size.shortestSide * 0.45,
@@ -46,7 +46,7 @@
   final double devicePixelRatio = ui.window.devicePixelRatio;
 
   // This transform scales the x and y coordinates by the devicePixelRatio.
-  Float64List deviceTransform = new Float64List(16)
+  final Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
     ..[10] = 1.0
@@ -56,7 +56,7 @@
   // transform that scale its children by the device pixel ratio. This transform
   // lets us paint in "logical" pixels which are converted to device pixels by
   // this scaling operation.
-  ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
+  final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
     ..pushTransform(deviceTransform)
     ..addPicture(ui.Offset.zero, picture)
     ..pop();
@@ -67,11 +67,11 @@
 }
 
 void beginFrame(Duration timeStamp) {
-  ui.Rect paintBounds = ui.Point.origin & (ui.window.physicalSize / ui.window.devicePixelRatio);
+  final ui.Rect paintBounds = ui.Point.origin & (ui.window.physicalSize / ui.window.devicePixelRatio);
   // First, record a picture with our painting commands.
-  ui.Picture picture = paint(paintBounds);
+  final ui.Picture picture = paint(paintBounds);
   // Second, include that picture in a scene graph.
-  ui.Scene scene = composite(picture, paintBounds);
+  final ui.Scene scene = composite(picture, paintBounds);
   // Third, instruct the engine to render that scene graph.
   ui.window.render(scene);
 }
diff --git a/examples/layers/rendering/custom_coordinate_systems.dart b/examples/layers/rendering/custom_coordinate_systems.dart
index 8b5d295..c1dd8ce 100644
--- a/examples/layers/rendering/custom_coordinate_systems.dart
+++ b/examples/layers/rendering/custom_coordinate_systems.dart
@@ -9,10 +9,10 @@
 import 'src/sector_layout.dart';
 
 RenderBox buildSectorExample() {
-  RenderSectorRing rootCircle = new RenderSectorRing(padding: 20.0);
+  final RenderSectorRing rootCircle = new RenderSectorRing(padding: 20.0);
   rootCircle.add(new RenderSolidColor(const Color(0xFF00FFFF), desiredDeltaTheta: kTwoPi * 0.15));
   rootCircle.add(new RenderSolidColor(const Color(0xFF0000FF), desiredDeltaTheta: kTwoPi * 0.4));
-  RenderSectorSlice stack = new RenderSectorSlice(padding: 2.0);
+  final RenderSectorSlice stack = new RenderSectorSlice(padding: 2.0);
   stack.add(new RenderSolidColor(const Color(0xFFFFFF00), desiredDeltaRadius: 20.0));
   stack.add(new RenderSolidColor(const Color(0xFFFF9000), desiredDeltaRadius: 20.0));
   stack.add(new RenderSolidColor(const Color(0xFF00FF00)));
diff --git a/examples/layers/rendering/flex_layout.dart b/examples/layers/rendering/flex_layout.dart
index 145d493..7175341 100644
--- a/examples/layers/rendering/flex_layout.dart
+++ b/examples/layers/rendering/flex_layout.dart
@@ -10,13 +10,13 @@
 import 'src/solid_color_box.dart';
 
 void main() {
-  RenderFlex table = new RenderFlex(direction: Axis.vertical);
+  final RenderFlex table = new RenderFlex(direction: Axis.vertical);
 
   void addAlignmentRow(CrossAxisAlignment crossAxisAlignment) {
     TextStyle style = const TextStyle(color: const Color(0xFF000000));
-    RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$crossAxisAlignment'));
+    final RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$crossAxisAlignment'));
     table.add(new RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0)));
-    RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
+    final RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
     style = const TextStyle(fontSize: 15.0, color: const Color(0xFF000000));
     row.add(new RenderDecoratedBox(
       decoration: const BoxDecoration(backgroundColor: const Color(0x7FFFCCCC)),
@@ -27,7 +27,7 @@
       decoration: const BoxDecoration(backgroundColor: const Color(0x7FCCFFCC)),
       child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo'))
     ));
-    RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
+    final RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
     style = const TextStyle(fontSize: 25.0, color: const Color(0xFF000000));
     subrow.add(new RenderDecoratedBox(
       decoration: const BoxDecoration(backgroundColor: const Color(0x7FCCCCFF)),
@@ -48,9 +48,9 @@
 
   void addJustificationRow(MainAxisAlignment justify) {
     const TextStyle style = const TextStyle(color: const Color(0xFF000000));
-    RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$justify'));
+    final RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$justify'));
     table.add(new RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0)));
-    RenderFlex row = new RenderFlex(direction: Axis.horizontal);
+    final RenderFlex row = new RenderFlex(direction: Axis.horizontal);
     row.add(new RenderSolidColorBox(const Color(0xFFFFCCCC), desiredSize: const Size(80.0, 60.0)));
     row.add(new RenderSolidColorBox(const Color(0xFFCCFFCC), desiredSize: const Size(64.0, 60.0)));
     row.add(new RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: const Size(160.0, 60.0)));
@@ -66,7 +66,7 @@
   addJustificationRow(MainAxisAlignment.spaceBetween);
   addJustificationRow(MainAxisAlignment.spaceAround);
 
-  RenderDecoratedBox root = new RenderDecoratedBox(
+  final RenderDecoratedBox root = new RenderDecoratedBox(
     decoration: const BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)),
     child: new RenderPadding(child: table, padding: const EdgeInsets.symmetric(vertical: 50.0))
   );
diff --git a/examples/layers/rendering/spinning_square.dart b/examples/layers/rendering/spinning_square.dart
index aa81d05..fcf97e6 100644
--- a/examples/layers/rendering/spinning_square.dart
+++ b/examples/layers/rendering/spinning_square.dart
@@ -19,12 +19,12 @@
 
 void main() {
   // We first create a render object that represents a green box.
-  RenderBox green = new RenderDecoratedBox(
+  final RenderBox green = new RenderDecoratedBox(
     decoration: const BoxDecoration(backgroundColor: const Color(0xFF00FF00))
   );
   // Second, we wrap that green box in a render object that forces the green box
   // to have a specific size.
-  RenderBox square = new RenderConstrainedBox(
+  final RenderBox square = new RenderConstrainedBox(
     additionalConstraints: const BoxConstraints.tightFor(width: 200.0, height: 200.0),
     child: green
   );
@@ -32,13 +32,13 @@
   // transform before painting its child. Each frame of the animation, we'll
   // update the transform of this render object to cause the green square to
   // spin.
-  RenderTransform spin = new RenderTransform(
+  final RenderTransform spin = new RenderTransform(
     transform: new Matrix4.identity(),
     alignment: FractionalOffset.center,
     child: square
   );
   // Finally, we center the spinning green square...
-  RenderBox root = new RenderPositionedBox(
+  final RenderBox root = new RenderPositionedBox(
     alignment: FractionalOffset.center,
     child: spin
   );
@@ -47,14 +47,14 @@
 
   // To make the square spin, we use an animation that repeats every 1800
   // milliseconds.
-  AnimationController animation = new AnimationController(
+  final AnimationController animation = new AnimationController(
     duration: const Duration(milliseconds: 1800),
     vsync: const NonStopVSync(),
   )..repeat();
   // The animation will produce a value between 0.0 and 1.0 each frame, but we
   // want to rotate the square using a value between 0.0 and math.PI. To change
   // the range of the animation, we use a Tween.
-  Tween<double> tween = new Tween<double>(begin: 0.0, end: math.PI);
+  final Tween<double> tween = new Tween<double>(begin: 0.0, end: math.PI);
   // We add a listener to the animation, which will be called every time the
   // animation ticks.
   animation.addListener(() {
diff --git a/examples/layers/rendering/src/sector_layout.dart b/examples/layers/rendering/src/sector_layout.dart
index a84703d..db7903f 100644
--- a/examples/layers/rendering/src/sector_layout.dart
+++ b/examples/layers/rendering/src/sector_layout.dart
@@ -167,13 +167,13 @@
 
     if (_decoration.backgroundColor != null) {
       final Canvas canvas = context.canvas;
-      Paint paint = new Paint()..color = _decoration.backgroundColor;
-      Path path = new Path();
-      double outerRadius = (parentData.radius + deltaRadius);
-      Rect outerBounds = new Rect.fromLTRB(offset.dx-outerRadius, offset.dy-outerRadius, offset.dx+outerRadius, offset.dy+outerRadius);
+      final Paint paint = new Paint()..color = _decoration.backgroundColor;
+      final Path path = new Path();
+      final double outerRadius = (parentData.radius + deltaRadius);
+      final Rect outerBounds = new Rect.fromLTRB(offset.dx-outerRadius, offset.dy-outerRadius, offset.dx+outerRadius, offset.dy+outerRadius);
       path.arcTo(outerBounds, parentData.theta, deltaTheta, true);
-      double innerRadius = parentData.radius;
-      Rect innerBounds = new Rect.fromLTRB(offset.dx-innerRadius, offset.dy-innerRadius, offset.dx+innerRadius, offset.dy+innerRadius);
+      final double innerRadius = parentData.radius;
+      final Rect innerBounds = new Rect.fromLTRB(offset.dx-innerRadius, offset.dy-innerRadius, offset.dx+innerRadius, offset.dy+innerRadius);
       path.arcTo(innerBounds, parentData.theta + deltaTheta, -deltaTheta, false);
       path.close();
       canvas.drawPath(path, paint);
@@ -248,19 +248,19 @@
 
   @override
   SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) {
-    double outerDeltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius);
-    double innerDeltaRadius = outerDeltaRadius - padding * 2.0;
-    double childRadius = radius + padding;
-    double paddingTheta = math.atan(padding / (radius + outerDeltaRadius));
+    final double outerDeltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius);
+    final double innerDeltaRadius = outerDeltaRadius - padding * 2.0;
+    final double childRadius = radius + padding;
+    final double paddingTheta = math.atan(padding / (radius + outerDeltaRadius));
     double innerTheta = paddingTheta; // increments with each child
     double remainingDeltaTheta = constraints.maxDeltaTheta - (innerTheta + paddingTheta);
     RenderSector child = firstChild;
     while (child != null) {
-      SectorConstraints innerConstraints = new SectorConstraints(
+      final SectorConstraints innerConstraints = new SectorConstraints(
         maxDeltaRadius: innerDeltaRadius,
         maxDeltaTheta: remainingDeltaTheta
       );
-      SectorDimensions childDimensions = child.getIntrinsicDimensions(innerConstraints, childRadius);
+      final SectorDimensions childDimensions = child.getIntrinsicDimensions(innerConstraints, childRadius);
       innerTheta += childDimensions.deltaTheta;
       remainingDeltaTheta -= childDimensions.deltaTheta;
       final SectorChildListParentData childParentData = child.parentData;
@@ -280,14 +280,14 @@
     assert(this.parentData is SectorParentData);
     deltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius);
     assert(deltaRadius < double.INFINITY);
-    double innerDeltaRadius = deltaRadius - padding * 2.0;
-    double childRadius = this.parentData.radius + padding;
-    double paddingTheta = math.atan(padding / (this.parentData.radius + deltaRadius));
+    final double innerDeltaRadius = deltaRadius - padding * 2.0;
+    final double childRadius = this.parentData.radius + padding;
+    final double paddingTheta = math.atan(padding / (this.parentData.radius + deltaRadius));
     double innerTheta = paddingTheta; // increments with each child
     double remainingDeltaTheta = constraints.maxDeltaTheta - (innerTheta + paddingTheta);
     RenderSector child = firstChild;
     while (child != null) {
-      SectorConstraints innerConstraints = new SectorConstraints(
+      final SectorConstraints innerConstraints = new SectorConstraints(
         maxDeltaRadius: innerDeltaRadius,
         maxDeltaTheta: remainingDeltaTheta
       );
@@ -363,18 +363,18 @@
   @override
   SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) {
     assert(this.parentData is SectorParentData);
-    double paddingTheta = math.atan(padding / this.parentData.radius);
-    double outerDeltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta);
-    double innerDeltaTheta = outerDeltaTheta - paddingTheta * 2.0;
+    final double paddingTheta = math.atan(padding / this.parentData.radius);
+    final double outerDeltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta);
+    final double innerDeltaTheta = outerDeltaTheta - paddingTheta * 2.0;
     double childRadius = this.parentData.radius + padding;
     double remainingDeltaRadius = constraints.maxDeltaRadius - (padding * 2.0);
     RenderSector child = firstChild;
     while (child != null) {
-      SectorConstraints innerConstraints = new SectorConstraints(
+      final SectorConstraints innerConstraints = new SectorConstraints(
         maxDeltaRadius: remainingDeltaRadius,
         maxDeltaTheta: innerDeltaTheta
       );
-      SectorDimensions childDimensions = child.getIntrinsicDimensions(innerConstraints, childRadius);
+      final SectorDimensions childDimensions = child.getIntrinsicDimensions(innerConstraints, childRadius);
       childRadius += childDimensions.deltaRadius;
       remainingDeltaRadius -= childDimensions.deltaRadius;
       final SectorChildListParentData childParentData = child.parentData;
@@ -392,14 +392,14 @@
     assert(this.parentData is SectorParentData);
     deltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta);
     assert(deltaTheta <= kTwoPi);
-    double paddingTheta = math.atan(padding / this.parentData.radius);
-    double innerTheta = this.parentData.theta + paddingTheta;
-    double innerDeltaTheta = deltaTheta - paddingTheta * 2.0;
+    final double paddingTheta = math.atan(padding / this.parentData.radius);
+    final double innerTheta = this.parentData.theta + paddingTheta;
+    final double innerDeltaTheta = deltaTheta - paddingTheta * 2.0;
     double childRadius = this.parentData.radius + padding;
     double remainingDeltaRadius = constraints.maxDeltaRadius - (padding * 2.0);
     RenderSector child = firstChild;
     while (child != null) {
-      SectorConstraints innerConstraints = new SectorConstraints(
+      final SectorConstraints innerConstraints = new SectorConstraints(
         maxDeltaRadius: remainingDeltaRadius,
         maxDeltaTheta: innerDeltaTheta
       );
@@ -489,9 +489,9 @@
     assert(child.parentData is SectorParentData);
     assert(width != null);
     assert(height != null);
-    double maxChildDeltaRadius = math.min(width, height) / 2.0 - innerRadius;
-    SectorDimensions childDimensions = child.getIntrinsicDimensions(new SectorConstraints(maxDeltaRadius: maxChildDeltaRadius), innerRadius);
-    double dimension = (innerRadius + childDimensions.deltaRadius) * 2.0;
+    final double maxChildDeltaRadius = math.min(width, height) / 2.0 - innerRadius;
+    final SectorDimensions childDimensions = child.getIntrinsicDimensions(new SectorConstraints(maxDeltaRadius: maxChildDeltaRadius), innerRadius);
+    final double dimension = (innerRadius + childDimensions.deltaRadius) * 2.0;
     return constraints.constrain(new Size(dimension, dimension));
   }
 
@@ -502,12 +502,12 @@
     } else {
       assert(child is RenderSector);
       assert(constraints.maxWidth < double.INFINITY || constraints.maxHeight < double.INFINITY);
-      double maxChildDeltaRadius = math.min(constraints.maxWidth, constraints.maxHeight) / 2.0 - innerRadius;
+      final double maxChildDeltaRadius = math.min(constraints.maxWidth, constraints.maxHeight) / 2.0 - innerRadius;
       assert(child.parentData is SectorParentData);
       child.parentData.radius = innerRadius;
       child.parentData.theta = 0.0;
       child.layout(new SectorConstraints(maxDeltaRadius: maxChildDeltaRadius), parentUsesSize: true);
-      double dimension = (innerRadius + child.deltaRadius) * 2.0;
+      final double dimension = (innerRadius + child.deltaRadius) * 2.0;
       size = constraints.constrain(new Size(dimension, dimension));
     }
   }
@@ -516,7 +516,7 @@
   void paint(PaintingContext context, Offset offset) {
     super.paint(context, offset);
     if (child != null) {
-      Rect bounds = offset & size;
+      final Rect bounds = offset & size;
       // we move the offset to the center of the circle for the RenderSectors
       context.paintChild(child, bounds.center.toOffset());
     }
@@ -532,8 +532,8 @@
     x -= size.width/2.0;
     y -= size.height/2.0;
     // convert to radius/theta
-    double radius = math.sqrt(x*x+y*y);
-    double theta = (math.atan2(x, -y) - math.PI/2.0) % kTwoPi;
+    final double radius = math.sqrt(x*x+y*y);
+    final double theta = (math.atan2(x, -y) - math.PI/2.0) % kTwoPi;
     if (radius < innerRadius)
       return false;
     if (radius >= innerRadius + child.deltaRadius)
diff --git a/examples/layers/rendering/touch_input.dart b/examples/layers/rendering/touch_input.dart
index c566949..fe4f054 100644
--- a/examples/layers/rendering/touch_input.dart
+++ b/examples/layers/rendering/touch_input.dart
@@ -65,7 +65,7 @@
   @override
   void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
     if (event is PointerDownEvent) {
-      Color color = _kColors[event.pointer.remainder(_kColors.length)];
+      final Color color = _kColors[event.pointer.remainder(_kColors.length)];
       _dots[event.pointer] = new Dot(color: color)..update(event);
       // We call markNeedsPaint to indicate that our painting commands have
       // changed and that paint needs to be called before displaying a new frame
@@ -101,7 +101,7 @@
 
 void main() {
   // Create some styled text to tell the user to interact with the app.
-  RenderParagraph paragraph = new RenderParagraph(
+  final RenderParagraph paragraph = new RenderParagraph(
     new TextSpan(
       style: new TextStyle(color: Colors.black87),
       text: "Touch me!"
@@ -110,7 +110,7 @@
   // A stack is a render object that layers its children on top of each other.
   // The bottom later is our RenderDots object, and on top of that we show the
   // text.
-  RenderStack stack = new RenderStack(
+  final RenderStack stack = new RenderStack(
     children: <RenderBox>[
       new RenderDots(),
       paragraph,
diff --git a/examples/layers/services/isolate.dart b/examples/layers/services/isolate.dart
index fe090cc..c80e2e8 100644
--- a/examples/layers/services/isolate.dart
+++ b/examples/layers/services/isolate.dart
@@ -36,7 +36,7 @@
   // Run the computation associated with this Calculator.
   void run() {
     int i = 0;
-    JsonDecoder decoder = new JsonDecoder(
+    final JsonDecoder decoder = new JsonDecoder(
       (dynamic key, dynamic value) {
         if (key is int && i++ % _NOTIFY_INTERVAL == 0)
           onProgressListener(i.toDouble(), _NUM_ITEMS.toDouble());
@@ -44,8 +44,8 @@
       }
     );
     try {
-      List<dynamic> result = decoder.convert(_data);
-      int n = result.length;
+      final List<dynamic> result = decoder.convert(_data);
+      final int n = result.length;
       onResultListener("Decoded $n results");
     } catch (e, stack) {
       print("Invalid JSON file: $e");
@@ -54,7 +54,7 @@
   }
 
   static String _replicateJson(String data, int count) {
-    StringBuffer buffer = new StringBuffer()..write("[");
+    final StringBuffer buffer = new StringBuffer()..write("[");
     for (int i = 0; i < count; i++) {
       buffer.write(data);
       if (i < count - 1)
@@ -178,8 +178,8 @@
   // Static and global variables are initialized anew in the spawned isolate,
   // in a separate memory space.
   static void _calculate(CalculationMessage message) {
-    SendPort sender = message.sendPort;
-    Calculator calculator = new Calculator(
+    final SendPort sender = message.sendPort;
+    final Calculator calculator = new Calculator(
       onProgressListener: (double completed, double total) {
         sender.send(<double>[ completed, total ]);
       },
diff --git a/examples/layers/widgets/custom_render_box.dart b/examples/layers/widgets/custom_render_box.dart
index 5c0f724..b93d8bc 100644
--- a/examples/layers/widgets/custom_render_box.dart
+++ b/examples/layers/widgets/custom_render_box.dart
@@ -30,7 +30,7 @@
     final Canvas canvas = context.canvas;
     canvas.drawRect(offset & size, new Paint()..color = const Color(0xFF0000FF));
 
-    Paint paint = new Paint()..color = const Color(0xFF00FF00);
+    final Paint paint = new Paint()..color = const Color(0xFF00FF00);
     for (Point point in _dots.values)
       canvas.drawCircle(point, 50.0, paint);
 
diff --git a/examples/layers/widgets/gestures.dart b/examples/layers/widgets/gestures.dart
index bb5f56d..a54a752 100644
--- a/examples/layers/widgets/gestures.dart
+++ b/examples/layers/widgets/gestures.dart
@@ -27,13 +27,13 @@
 
   @override
   void paint(Canvas canvas, Size size) {
-    Point center = (size.center(Point.origin).toOffset() * zoom + offset).toPoint();
-    double radius = size.width / 2.0 * zoom;
-    Gradient gradient = new RadialGradient(
+    final Point center = (size.center(Point.origin).toOffset() * zoom + offset).toPoint();
+    final double radius = size.width / 2.0 * zoom;
+    final Gradient gradient = new RadialGradient(
       colors: forward ? <Color>[swatch[50], swatch[900]]
                       : <Color>[swatch[900], swatch[50]]
     );
-    Paint paint = new Paint()
+    final Paint paint = new Paint()
       ..shader = gradient.createShader(new Rect.fromLTWH(
         center.x - radius,
         center.y - radius,
@@ -92,7 +92,7 @@
       _zoom = (_previousZoom * details.scale);
 
       // Ensure that item under the focal point stays in the same place despite zooming
-      Offset normalizedOffset = (_startingFocalPoint.toOffset() - _previousOffset) / _previousZoom;
+      final Offset normalizedOffset = (_startingFocalPoint.toOffset() - _previousOffset) / _previousZoom;
       _offset = details.focalPoint.toOffset() - normalizedOffset * _zoom;
     });
   }
diff --git a/examples/layers/widgets/media_query.dart b/examples/layers/widgets/media_query.dart
index 475c358..400ae77 100644
--- a/examples/layers/widgets/media_query.dart
+++ b/examples/layers/widgets/media_query.dart
@@ -90,7 +90,7 @@
 }
 
 List<String> _initNames() {
-  List<String> names = <String>[];
+  final List<String> names = <String>[];
   for (int i = 0; i < 30; i++)
     names.add('Item $i');
   return names;
diff --git a/examples/layers/widgets/sectors.dart b/examples/layers/widgets/sectors.dart
index 6d9b0d2..060b087 100644
--- a/examples/layers/widgets/sectors.dart
+++ b/examples/layers/widgets/sectors.dart
@@ -54,13 +54,13 @@
     int index = 0;
     while (index < actualSectorSizes.length && index < wantedSectorSizes.length && actualSectorSizes[index] == wantedSectorSizes[index])
       index += 1;
-    RenderSectorRing ring = sectors.child;
+    final RenderSectorRing ring = sectors.child;
     while (index < actualSectorSizes.length) {
       ring.remove(ring.lastChild);
       actualSectorSizes.removeLast();
     }
     while (index < wantedSectorSizes.length) {
-      Color color = new Color(((0xFF << 24) + rand.nextInt(0xFFFFFF)) | 0x808080);
+      final Color color = new Color(((0xFF << 24) + rand.nextInt(0xFFFFFF)) | 0x808080);
       ring.add(new RenderSolidColor(color, desiredDeltaTheta: wantedSectorSizes[index]));
       actualSectorSizes.add(wantedSectorSizes[index]);
       index += 1;
@@ -68,7 +68,7 @@
   }
 
   static RenderBox initSector(Color color) {
-    RenderSectorRing ring = new RenderSectorRing(padding: 1.0);
+    final RenderSectorRing ring = new RenderSectorRing(padding: 1.0);
     ring.add(new RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
     ring.add(new RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
     ring.add(new RenderSolidColor(color, desiredDeltaTheta: kTwoPi * 0.2));
diff --git a/examples/layers/widgets/spinning_mixed.dart b/examples/layers/widgets/spinning_mixed.dart
index 099e980..eb0aae3 100644
--- a/examples/layers/widgets/spinning_mixed.dart
+++ b/examples/layers/widgets/spinning_mixed.dart
@@ -9,9 +9,9 @@
 
 // Solid colour, RenderObject version
 void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex: 0 }) {
-  RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
+  final RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
   parent.add(child);
-  FlexParentData childParentData = child.parentData;
+  final FlexParentData childParentData = child.parentData;
   childParentData.flex = flex;
 }
 
@@ -80,7 +80,7 @@
 void rotate(Duration timeStamp) {
   if (timeBase == null)
     timeBase = timeStamp;
-  double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; // radians
+  final double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; // radians
 
   transformBox.setIdentity();
   transformBox.rotateZ(delta);
@@ -89,17 +89,17 @@
 }
 
 void main() {
-  WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
-  RenderProxyBox proxy = new RenderProxyBox();
+  final WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
+  final RenderProxyBox proxy = new RenderProxyBox();
   attachWidgetTreeToRenderTree(proxy);
 
-  RenderFlex flexRoot = new RenderFlex(direction: Axis.vertical);
+  final RenderFlex flexRoot = new RenderFlex(direction: Axis.vertical);
   addFlexChildSolidColor(flexRoot, const Color(0xFFFF00FF), flex: 1);
   flexRoot.add(proxy);
   addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
 
   transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity(), alignment: FractionalOffset.center);
-  RenderPadding root = new RenderPadding(padding: const EdgeInsets.all(80.0), child: transformBox);
+  final RenderPadding root = new RenderPadding(padding: const EdgeInsets.all(80.0), child: transformBox);
 
   binding.renderView.child = root;
   binding.addPersistentFrameCallback(rotate);
diff --git a/examples/layers/widgets/styled_text.dart b/examples/layers/widgets/styled_text.dart
index 63e562d..c24c3c4 100644
--- a/examples/layers/widgets/styled_text.dart
+++ b/examples/layers/widgets/styled_text.dart
@@ -33,7 +33,7 @@
 );
 
 Widget toStyledText(String name, String text) {
-  TextStyle lineStyle = (name == "Dave") ? _kDaveStyle : _kHalStyle;
+  final TextStyle lineStyle = (name == "Dave") ? _kDaveStyle : _kHalStyle;
   return new RichText(
     key: new Key(text),
     text: new TextSpan(
@@ -94,11 +94,11 @@
 
   @override
   Widget build(BuildContext context) {
-    List<Widget> lines = _kNameLines
+    final List<Widget> lines = _kNameLines
       .map<Widget>((List<String> nameAndText) => _toText(nameAndText[0], nameAndText[1]))
       .toList();
 
-    List<Widget> children = <Widget>[];
+    final List<Widget> children = <Widget>[];
     for (Widget line in lines) {
       children.add(line);
       if (line != lines.last)