diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart
index d6925e3..d0bbd4c 100644
--- a/dev/manual_tests/card_collection.dart
+++ b/dev/manual_tests/card_collection.dart
@@ -26,9 +26,9 @@
     const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
 
   // TODO(hansmuller): need a local image asset
-  static const _sunshineURL = "http://www.walltor.com/images/wallpaper/good-morning-sunshine-58540.jpg";
+  static const String _sunshineURL = "http://www.walltor.com/images/wallpaper/good-morning-sunshine-58540.jpg";
 
-  static const kCardMargins = 8.0;
+  static const double kCardMargins = 8.0;
 
   final TextStyle backgroundTextStyle =
     Typography.white.title.copyWith(textAlign: TextAlign.center);
diff --git a/dev/manual_tests/pageable_list.dart b/dev/manual_tests/pageable_list.dart
index 6f0eca1..b6aed7b 100644
--- a/dev/manual_tests/pageable_list.dart
+++ b/dev/manual_tests/pageable_list.dart
@@ -23,7 +23,7 @@
     List<Size> cardSizes = [
       [100.0, 300.0], [300.0, 100.0], [200.0, 400.0], [400.0, 400.0], [300.0, 400.0]
     ]
-    .map((args) => new Size(args[0], args[1]))
+    .map((List<double> args) => new Size(args[0], args[1]))
     .toList();
 
     cardModels = new List<CardModel>.generate(cardSizes.length, (int i) {
diff --git a/examples/layers/services/media_service.dart b/examples/layers/services/media_service.dart
index f7f234d..23d961d 100644
--- a/examples/layers/services/media_service.dart
+++ b/examples/layers/services/media_service.dart
@@ -39,7 +39,7 @@
     player.ptr.pause();
   }
 
-  Future load(MediaServiceProxy mediaService) async {
+  Future<Null> load(MediaServiceProxy mediaService) async {
     try {
       mediaService.ptr.createPlayer(player);
       UrlResponse response = await fetchUrl(soundUrl);
@@ -61,11 +61,11 @@
     new PianoKey(Colors.purple[500], iLoveYou),
   ];
 
-  Future loadSounds() async {
+  Future<Null> loadSounds() async {
     MediaServiceProxy mediaService = new MediaServiceProxy.unbound();
     try {
       shell.connectToService("mojo:media_service", mediaService);
-      List<Future<MediaPlayerPrepareResponseParams>> pending = <Future<MediaPlayerPrepareResponseParams>>[];
+      List<Future<Null>> pending = <Future<Null>>[];
       for (PianoKey key in keys)
         pending.add(key.load(mediaService));
       await Future.wait(pending);
@@ -93,8 +93,8 @@
 }
 
 Widget statusBox(Widget child) {
-  const mediumGray = const Color(0xff555555);
-  const darkGray = const Color(0xff222222);
+  const Color mediumGray = const Color(0xff555555);
+  const Color darkGray = const Color(0xff222222);
   return new Center(
     child: new Container(
       decoration: const BoxDecoration(
@@ -121,7 +121,7 @@
   );
 }
 
-Future main() async {
+Future<Null> main() async {
   runApp(splashScreen());
 
   PianoApp app = new PianoApp();
diff --git a/examples/material_gallery/lib/demo/buttons_demo.dart b/examples/material_gallery/lib/demo/buttons_demo.dart
index 1aeb29e..fc6ee21 100644
--- a/examples/material_gallery/lib/demo/buttons_demo.dart
+++ b/examples/material_gallery/lib/demo/buttons_demo.dart
@@ -80,7 +80,7 @@
           tooltip: 'Open FAB demos',
           child: new Icon(icon: Icons.add),
           onPressed: () {
-            Navigator.push(context, new MaterialPageRoute(
+            Navigator.push(context, new MaterialPageRoute<Null>(
               builder: (BuildContext context) => new TabsFabDemo()
             ));
           }
@@ -97,7 +97,7 @@
           new RaisedButton(
             child: new Text("Launch Demo"),
             onPressed: () {
-              Navigator.push(context, new MaterialPageRoute(
+              Navigator.push(context, new MaterialPageRoute<Null>(
                 builder: (BuildContext context) => new SnackBarDemo()
               ));
             }
@@ -127,7 +127,7 @@
             new FlatButton(
               child: new Text("Launch Demo"),
               onPressed: () {
-                Navigator.push(context, new MaterialPageRoute(
+                Navigator.push(context, new MaterialPageRoute<Null>(
                   builder: (_) => new DialogDemo()
                 ));
               }
@@ -200,10 +200,10 @@
           center: new Text("Buttons"),
           tabBar: new TabBar<_ButtonDemo>(
             isScrollable: true,
-            labels: new Map.fromIterable(demos, value: (_ButtonDemo demo) => demo.tabLabel)
+            labels: new Map<_ButtonDemo, TabLabel>.fromIterable(demos, value: (_ButtonDemo demo) => demo.tabLabel)
           )
         ),
-        body: new TabBarView(
+        body: new TabBarView<_ButtonDemo>(
           children: demos.map(buildTabView).toList()
         )
       )
diff --git a/examples/material_gallery/lib/demo/colors_demo.dart b/examples/material_gallery/lib/demo/colors_demo.dart
index 1239807..2e5e9dc 100644
--- a/examples/material_gallery/lib/demo/colors_demo.dart
+++ b/examples/material_gallery/lib/demo/colors_demo.dart
@@ -77,8 +77,8 @@
   }
 
   final ColorSwatch swatch;
-  final blackTextStyle = Typography.black.body1;
-  final whiteTextStyle = Typography.white.body1;
+  final TextStyle blackTextStyle = Typography.black.body1;
+  final TextStyle whiteTextStyle = Typography.white.body1;
 
   Widget build(BuildContext context) {
     List<Widget> colorItems =  swatch.colors.keys.map((int index) {
@@ -116,12 +116,12 @@
           center: new Text("Colors"),
           tabBar: new TabBar<ColorSwatch>(
             isScrollable: true,
-            labels: new Map.fromIterable(colorSwatches, value: (ColorSwatch swatch) {
+            labels: new Map<ColorSwatch, TabLabel>.fromIterable(colorSwatches, value: (ColorSwatch swatch) {
               return new TabLabel(text: swatch.name);
             })
           )
         ),
-        body: new TabBarView(
+        body: new TabBarView<ColorSwatch>(
           children: colorSwatches.map((ColorSwatch swatch) {
             return new ColorSwatchTabView(swatch: swatch);
           })
diff --git a/examples/material_gallery/lib/demo/date_picker_demo.dart b/examples/material_gallery/lib/demo/date_picker_demo.dart
index 9338cc7..7022ad2 100644
--- a/examples/material_gallery/lib/demo/date_picker_demo.dart
+++ b/examples/material_gallery/lib/demo/date_picker_demo.dart
@@ -14,7 +14,7 @@
 class _DatePickerDemoState extends State<DatePickerDemo> {
   DateTime _selectedDate = new DateTime.now();
 
-  Future _handleSelectDate() async {
+  Future<Null> _handleSelectDate() async {
     DateTime picked = await showDatePicker(
       context: context,
       initialDate: _selectedDate,
diff --git a/examples/material_gallery/lib/demo/dialog_demo.dart b/examples/material_gallery/lib/demo/dialog_demo.dart
index 4c00efd..46ccb73 100644
--- a/examples/material_gallery/lib/demo/dialog_demo.dart
+++ b/examples/material_gallery/lib/demo/dialog_demo.dart
@@ -60,12 +60,12 @@
 class DialogDemoState extends State<DialogDemo> {
   final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
 
-  void showDemoDialog({ BuildContext context, Dialog dialog }) {
-    showDialog(
+  void showDemoDialog/*<T>*/({ BuildContext context, Dialog dialog }) {
+    showDialog/*<T>*/(
       context: context,
       child: dialog
     )
-    .then((dynamic value) { // The value passed to Navigator.pop() or null.
+    .then((dynamic/*=T*/ value) { // The value passed to Navigator.pop() or null.
       if (value != null) {
         scaffoldKey.currentState.showSnackBar(new SnackBar(
           content: new Text('You selected: $value')
@@ -89,7 +89,7 @@
           new RaisedButton(
             child: new Text('ALERT'),
             onPressed: () {
-              showDemoDialog(
+              showDemoDialog/*<DialogDemoAction>*/(
                 context: context,
                 dialog: new Dialog(
                   content: new Text(
@@ -113,7 +113,7 @@
           new RaisedButton(
             child: new Text('ALERT WITH TITLE'),
             onPressed: () {
-              showDemoDialog(
+              showDemoDialog/*<DialogDemoAction>*/(
                 context: context,
                 dialog: new Dialog(
                   title: new Text("Use Google's location service?"),
@@ -138,7 +138,7 @@
           new RaisedButton(
             child: new Text('SIMPLE'),
             onPressed: () {
-              showDemoDialog(
+              showDemoDialog/*<String>*/(
                 context: context,
                 dialog: new Dialog(
                   title: new Text('Set backup account'),
@@ -174,7 +174,7 @@
                 context: context,
                 initialTime: const TimeOfDay(hour: 15, minute: 30)
               )
-              .then((value) { // The value passed to Navigator.pop() or null.
+              .then((TimeOfDay value) { // The value passed to Navigator.pop() or null.
                 if (value != null) {
                   scaffoldKey.currentState.showSnackBar(new SnackBar(
                     content: new Text('You selected: $value')
@@ -186,7 +186,7 @@
           new RaisedButton(
             child: new Text('FULLSCREEN'),
             onPressed: () {
-              Navigator.push(context, new MaterialPageRoute(
+              Navigator.push(context, new MaterialPageRoute<Null>(
                 builder: (BuildContext context) => new FullScreenDialogDemo()
               ));
             }
diff --git a/examples/material_gallery/lib/demo/fitness_demo.dart b/examples/material_gallery/lib/demo/fitness_demo.dart
index b64c588..d15682e 100644
--- a/examples/material_gallery/lib/demo/fitness_demo.dart
+++ b/examples/material_gallery/lib/demo/fitness_demo.dart
@@ -33,7 +33,7 @@
 
 class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
 
-  Future _loadAssets(AssetBundle bundle) async {
+  Future<Null> _loadAssets(AssetBundle bundle) async {
     _images = new ImageMap(bundle);
     await _images.load(<String>[
       'packages/flutter_gallery_assets/jumpingjack.png',
@@ -267,9 +267,9 @@
 class _ProgressCircle extends NodeWithSize {
   _ProgressCircle(Size size, [this.value = 0.0]) : super(size);
 
-  static const _kTwoPI = math.PI * 2.0;
-  static const _kEpsilon = .0000001;
-  static const _kSweep = _kTwoPI - _kEpsilon;
+  static const double _kTwoPI = math.PI * 2.0;
+  static const double _kEpsilon = .0000001;
+  static const double _kSweep = _kTwoPI - _kEpsilon;
 
   double value;
 
diff --git a/examples/material_gallery/lib/demo/grid_list_demo.dart b/examples/material_gallery/lib/demo/grid_list_demo.dart
index 169dc66..c3aaea8 100644
--- a/examples/material_gallery/lib/demo/grid_list_demo.dart
+++ b/examples/material_gallery/lib/demo/grid_list_demo.dart
@@ -38,7 +38,7 @@
   final GridDemoTileStyle tileStyle;
 
   void showPhoto(BuildContext context) {
-    Navigator.push(context, new MaterialPageRoute(
+    Navigator.push(context, new MaterialPageRoute<Null>(
       builder: (BuildContext context) {
         return new Scaffold(
           toolBar: new ToolBar(
@@ -138,7 +138,7 @@
   GridDemoTileStyle tileStyle = GridDemoTileStyle.twoLine;
 
   void showTileStyleMenu(BuildContext context) {
-    final List<PopupMenuItem> items = <PopupMenuItem<GridDemoTileStyle>>[
+    final List<PopupMenuItem<GridDemoTileStyle>> items = <PopupMenuItem<GridDemoTileStyle>>[
       new PopupMenuItem<GridDemoTileStyle>(
         value: GridDemoTileStyle.imageOnly,
         child: new Text('Image only')
diff --git a/examples/material_gallery/lib/demo/leave_behind_demo.dart b/examples/material_gallery/lib/demo/leave_behind_demo.dart
index c69c01b..a5dbb30 100644
--- a/examples/material_gallery/lib/demo/leave_behind_demo.dart
+++ b/examples/material_gallery/lib/demo/leave_behind_demo.dart
@@ -37,7 +37,7 @@
   List<LeaveBehindItem> leaveBehindItems;
 
   void initListItems() {
-    leaveBehindItems = new List.generate(16, (int index) {
+    leaveBehindItems = new List<LeaveBehindItem>.generate(16, (int index) {
       return new LeaveBehindItem(
         index: index,
         name: 'Item $index Sender',
@@ -130,7 +130,7 @@
         right: <Widget>[
           new PopupMenuButton<LeaveBehindDemoAction>(
             onSelected: handleDemoAction,
-            items: <PopupMenuEntry>[
+            items: <PopupMenuEntry<LeaveBehindDemoAction>>[
               new PopupMenuItem<LeaveBehindDemoAction>(
                 value: LeaveBehindDemoAction.reset,
                 child: new Text('Reset the list')
diff --git a/examples/material_gallery/lib/demo/list_demo.dart b/examples/material_gallery/lib/demo/list_demo.dart
index 053cb93..4966b98 100644
--- a/examples/material_gallery/lib/demo/list_demo.dart
+++ b/examples/material_gallery/lib/demo/list_demo.dart
@@ -19,7 +19,7 @@
 class ListDemoState extends State<ListDemo> {
   final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
 
-  ScaffoldFeatureController _bottomSheet;
+  PersistentBottomSheetController<Null> _bottomSheet;
   ListDemoItemSize _itemSize = ListDemoItemSize.threeLine;
   bool _dense = false;
   bool _showAvatars = true;
diff --git a/examples/material_gallery/lib/demo/menu_demo.dart b/examples/material_gallery/lib/demo/menu_demo.dart
index a8d3f9b..b219bfb 100644
--- a/examples/material_gallery/lib/demo/menu_demo.dart
+++ b/examples/material_gallery/lib/demo/menu_demo.dart
@@ -176,7 +176,7 @@
             right: new PopupMenuButton<String>(
               onSelected: showCheckedMenuSelections,
               items: <PopupMenuItem<String>>[
-                new CheckedPopupMenuItem(
+                new CheckedPopupMenuItem<String>(
                   value: _checkedValue1,
                   checked: isChecked(_checkedValue1),
                   child: new Text(_checkedValue1)
diff --git a/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart b/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart
index 687bf35..675c644 100644
--- a/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart
+++ b/examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart
@@ -21,7 +21,7 @@
           child: new RaisedButton(
             child: new Text('Show the modal bottom sheet', style: textStyle),
             onPressed: () {
-              showModalBottomSheet(context: context, builder: (_) {
+              showModalBottomSheet/*<Null>*/(context: context, builder: (BuildContext context) {
                 return new Container(
                   child: new Padding(
                     padding: const EdgeDims.all(32.0),
diff --git a/examples/material_gallery/lib/demo/page_selector_demo.dart b/examples/material_gallery/lib/demo/page_selector_demo.dart
index 3d8dceb..31a83da 100644
--- a/examples/material_gallery/lib/demo/page_selector_demo.dart
+++ b/examples/material_gallery/lib/demo/page_selector_demo.dart
@@ -7,7 +7,7 @@
 class PageSelectorDemo extends StatelessComponent {
 
   void _handleArrowButtonPress(BuildContext context, int delta) {
-    final TabBarSelectionState selection = TabBarSelection.of(context);
+    final TabBarSelectionState<IconData> selection = TabBarSelection.of/*<IconData>*/(context);
     if (!selection.valueIsChanging)
       selection.value = selection.values[(selection.index + delta).clamp(0, selection.values.length - 1)];
   }
@@ -53,7 +53,7 @@
                   )
                 ),
                 new Flexible(
-                  child: new TabBarView(
+                  child: new TabBarView<IconData>(
                     children: icons.map((IconData icon) {
                       return new Container(
                         key: new ObjectKey(icon),
diff --git a/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart b/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart
index c2ce5eb..840e5da 100644
--- a/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart
+++ b/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart
@@ -82,7 +82,7 @@
   final WidgetBuilder builder;
 
   void showDemo(BuildContext context) {
-    Navigator.push(context, new MaterialPageRoute(builder: builder));
+    Navigator.push(context, new MaterialPageRoute<Null>(builder: builder));
   }
 
   Widget build(BuildContext context) {
diff --git a/examples/material_gallery/lib/demo/tabs_demo.dart b/examples/material_gallery/lib/demo/tabs_demo.dart
index 7301455..3df5e45 100644
--- a/examples/material_gallery/lib/demo/tabs_demo.dart
+++ b/examples/material_gallery/lib/demo/tabs_demo.dart
@@ -25,20 +25,20 @@
 
   Widget build(BuildContext context) {
     final Color iconColor = Theme.of(context).accentColor;
-    return new TabBarSelection(
+    return new TabBarSelection<IconData>(
       values: icons,
       child: new Scaffold(
         toolBar: new ToolBar(
           center: new Text("Scrollable Tabs"),
-          tabBar: new TabBar<String>(
+          tabBar: new TabBar<IconData>(
             isScrollable: true,
-            labels: new Map.fromIterable(
+            labels: new Map<IconData, TabLabel>.fromIterable(
               icons,
               value: (IconData icon) => new TabLabel(text: labels[icon], icon: icon)
             )
           )
         ),
-        body: new TabBarView(
+        body: new TabBarView<IconData>(
           children: icons.map((IconData icon) {
             return new Container(
               key: new ObjectKey(icon),
diff --git a/examples/material_gallery/lib/demo/tabs_fab_demo.dart b/examples/material_gallery/lib/demo/tabs_fab_demo.dart
index 136bd8c..1f13edd 100644
--- a/examples/material_gallery/lib/demo/tabs_fab_demo.dart
+++ b/examples/material_gallery/lib/demo/tabs_fab_demo.dart
@@ -97,7 +97,7 @@
         toolBar: new ToolBar(
           center: new Text("FAB per Tab"),
           tabBar: new TabBar<_Page>(
-            labels: new Map.fromIterable(pages, value: (_Page page) => page.tabLabel)
+            labels: new Map<_Page, TabLabel>.fromIterable(pages, value: (_Page page) => page.tabLabel)
           )
         ),
         floatingActionButton: !selectedPage.fabDefined ? null : new FloatingActionButton(
@@ -107,7 +107,7 @@
           child: selectedPage.fabIcon,
           onPressed: _showExplanatoryText
         ),
-        body: new TabBarView(children: pages.map(buildTabView).toList())
+        body: new TabBarView<_Page>(children: pages.map(buildTabView).toList())
       )
     );
   }
diff --git a/examples/material_gallery/lib/demo/time_picker_demo.dart b/examples/material_gallery/lib/demo/time_picker_demo.dart
index dd06afc..1ab5e15 100644
--- a/examples/material_gallery/lib/demo/time_picker_demo.dart
+++ b/examples/material_gallery/lib/demo/time_picker_demo.dart
@@ -13,7 +13,7 @@
 class _TimePickerDemoState extends State<TimePickerDemo> {
   TimeOfDay _selectedTime = const TimeOfDay(hour: 7, minute: 28);
 
-  Future _handleSelectTime() async {
+  Future<Null> _handleSelectTime() async {
     TimeOfDay picked = await showTimePicker(
       context: context,
       initialTime: _selectedTime
diff --git a/examples/material_gallery/lib/demo/weather_demo.dart b/examples/material_gallery/lib/demo/weather_demo.dart
index c8ddcfd..fb65a9f 100644
--- a/examples/material_gallery/lib/demo/weather_demo.dart
+++ b/examples/material_gallery/lib/demo/weather_demo.dart
@@ -24,7 +24,7 @@
 
 class _WeatherDemoState extends State<WeatherDemo> {
 
-  Future _loadAssets(AssetBundle bundle) async {
+  Future<Null> _loadAssets(AssetBundle bundle) async {
     _images = new ImageMap(bundle);
     await _images.load(<String>[
       'packages/flutter_gallery_assets/clouds-0.png',
diff --git a/examples/material_gallery/lib/gallery/section.dart b/examples/material_gallery/lib/gallery/section.dart
index 2081fb1..e9cd9b8 100644
--- a/examples/material_gallery/lib/gallery/section.dart
+++ b/examples/material_gallery/lib/gallery/section.dart
@@ -16,7 +16,7 @@
   final List<GalleryDemo> demos;
 
   void showDemo(GalleryDemo demo, BuildContext context, ThemeData theme) {
-    Navigator.push(context, new MaterialPageRoute(
+    Navigator.push(context, new MaterialPageRoute<Null>(
       builder: (BuildContext context) {
         Widget child = (demo.builder == null) ? null : demo.builder();
         return new Theme(data: theme, child: child);
@@ -31,7 +31,7 @@
     );
     final double appBarHeight = 200.0;
     final Key scrollableKey = new ValueKey<String>(title); // assume section titles differ
-    Navigator.push(context, new MaterialPageRoute(
+    Navigator.push(context, new MaterialPageRoute<Null>(
       builder: (BuildContext context) {
         return new Theme(
           data: theme,
diff --git a/examples/stocks/lib/main.dart b/examples/stocks/lib/main.dart
index 977a9b7..d29394d 100644
--- a/examples/stocks/lib/main.dart
+++ b/examples/stocks/lib/main.dart
@@ -75,7 +75,7 @@
     }
   }
 
-  Route _getRoute(RouteSettings settings) {
+  Route<Null> _getRoute(RouteSettings settings) {
     List<String> path = settings.name.split('/');
     if (path[0] != '')
       return null;
@@ -83,7 +83,7 @@
       if (path.length != 3)
         return null;
       if (_stocks.containsKey(path[2])) {
-        return new MaterialPageRoute(
+        return new MaterialPageRoute<Null>(
           settings: settings,
           builder: (BuildContext context) => new StockSymbolPage(stock: _stocks[path[2]])
         );
diff --git a/examples/stocks/lib/stock_data.dart b/examples/stocks/lib/stock_data.dart
index ae034d3..386f9a0 100644
--- a/examples/stocks/lib/stock_data.dart
+++ b/examples/stocks/lib/stock_data.dart
@@ -53,7 +53,7 @@
 }
 
 typedef void StockDataCallback(StockData data);
-const _kChunkCount = 30;
+const int _kChunkCount = 30;
 
 String _urlToFetch(int chunk) {
   return 'https://domokit.github.io/examples/stocks/data/stock_data_$chunk.json';
diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart
index 599d1cd..884cf02 100644
--- a/examples/stocks/lib/stock_home.dart
+++ b/examples/stocks/lib/stock_home.dart
@@ -321,7 +321,7 @@
   }
 
   void _handleCreateCompany() {
-    showModalBottomSheet(
+    showModalBottomSheet/*<int, double>*/( // XXXXXX DO NOT CHECK IN XXXXXX THIS IS A CHECK OF THE ANALYZER
       context: context,
       builder: (BuildContext context) => new _CreateCompanySheet()
     );
@@ -344,7 +344,7 @@
         toolBar: _isSearching ? buildSearchBar() : buildToolBar(),
         floatingActionButton: buildFloatingActionButton(),
         drawer: _buildDrawer(context),
-        body: new TabBarView(
+        body: new TabBarView<StockHomeTab>(
           children: <Widget>[
             _buildStockTab(context, StockHomeTab.market, config.symbols),
             _buildStockTab(context, StockHomeTab.portfolio, portfolioSymbols),
diff --git a/examples/stocks/lib/stock_list.dart b/examples/stocks/lib/stock_list.dart
index 9634180..e94f296 100644
--- a/examples/stocks/lib/stock_list.dart
+++ b/examples/stocks/lib/stock_list.dart
@@ -18,7 +18,7 @@
 
   Widget build(BuildContext context) {
     return new ScrollableList(
-      key: const ValueKey('stock-list'),
+      key: const ValueKey<String>('stock-list'),
       itemExtent: StockRow.kHeight,
       children: stocks.map((Stock stock) {
         return new StockRow(
diff --git a/examples/stocks/test/locale_test.dart b/examples/stocks/test/locale_test.dart
index 150fe97..4044279 100644
--- a/examples/stocks/test/locale_test.dart
+++ b/examples/stocks/test/locale_test.dart
@@ -17,11 +17,12 @@
       tester.async.flushMicrotasks(); // see https://github.com/flutter/flutter/issues/1865
       tester.pump();
 
-      Element<Text> tab = tester.findText('MARKET');
+      Element tab = tester.findText('MARKET');
       expect(tab, isNotNull);
       tester.setLocale("es", "US");
       tester.pump();
-      expect(tab.widget.data, equals("MERCADO"));
+      Text text = tab.widget;
+      expect(text.data, equals("MERCADO"));
 
       // TODO(abarth): We're leaking an animation. We should track down the leak
       // and plug it rather than waiting for the animation to end here.
diff --git a/examples/stocks/test_driver/scroll_perf_test.dart b/examples/stocks/test_driver/scroll_perf_test.dart
index f5ba03a..6165417 100644
--- a/examples/stocks/test_driver/scroll_perf_test.dart
+++ b/examples/stocks/test_driver/scroll_perf_test.dart
@@ -27,13 +27,13 @@
       // Scroll down 5 times
       for (int i = 0; i < 5; i++) {
         await driver.scroll(stockList, 0.0, -300.0, new Duration(milliseconds: 300));
-        await new Future.delayed(new Duration(milliseconds: 500));
+        await new Future<Null>.delayed(new Duration(milliseconds: 500));
       }
 
       // Scroll up 5 times
       for (int i = 0; i < 5; i++) {
         await driver.scroll(stockList, 0.0, 300.0, new Duration(milliseconds: 300));
-        await new Future.delayed(new Duration(milliseconds: 500));
+        await new Future<Null>.delayed(new Duration(milliseconds: 500));
       }
     });
   });
diff --git a/packages/cassowary/lib/expression.dart b/packages/cassowary/lib/expression.dart
index 37fc5d9..03e23da 100644
--- a/packages/cassowary/lib/expression.dart
+++ b/packages/cassowary/lib/expression.dart
@@ -18,108 +18,121 @@
   bool get isConstant => terms.length == 0;
 
   @override
-  double get value => terms.fold(constant, (value, term) => value + term.value);
+  double get value => terms.fold(constant, (double value, Term term) => value + term.value);
 
   @override
   Expression asExpression() => this;
 
-  Constraint _createConstraint(
-      _EquationMember /* rhs */ value, Relation relation) {
+  Constraint _createConstraint(_EquationMember /* rhs */ value, Relation relation) {
     if (value is ConstantMember) {
       return new Constraint(
-          new Expression(new List.from(terms), constant - value.value),
-          relation);
+        new Expression(new List<Term>.from(terms), constant - value.value),
+        relation
+      );
     }
 
     if (value is Param) {
-      var newTerms = new List<Term>.from(terms)
+      List<Term> newTerms = new List<Term>.from(terms)
         ..add(new Term(value.variable, -1.0));
       return new Constraint(new Expression(newTerms, constant), relation);
     }
 
     if (value is Term) {
-      var newTerms = new List<Term>.from(terms)
+      List<Term> newTerms = new List<Term>.from(terms)
         ..add(new Term(value.variable, -value.coefficient));
       return new Constraint(new Expression(newTerms, constant), relation);
     }
 
     if (value is Expression) {
-      var newTerms = value.terms.fold(new List<Term>.from(terms),
-          (list, t) => list..add(new Term(t.variable, -t.coefficient)));
+      List<Term> newTerms = value.terms.fold(
+        new List<Term>.from(terms),
+        (List<Term> list, Term t) {
+          return list..add(new Term(t.variable, -t.coefficient));
+        }
+      );
       return new Constraint(
-          new Expression(newTerms, constant - value.constant), relation);
+        new Expression(newTerms, constant - value.constant),
+        relation
+      );
     }
-
     assert(false);
     return null;
   }
 
   @override
-  Constraint operator >=(_EquationMember value) =>
-      _createConstraint(value, Relation.greaterThanOrEqualTo);
+  Constraint operator >=(_EquationMember value) {
+    return _createConstraint(value, Relation.greaterThanOrEqualTo);
+  }
 
   @override
-  Constraint operator <=(_EquationMember value) =>
-      _createConstraint(value, Relation.lessThanOrEqualTo);
+  Constraint operator <=(_EquationMember value) {
+    return _createConstraint(value, Relation.lessThanOrEqualTo);
+  }
 
   @override
-  Constraint equals(_EquationMember value) =>
-    _createConstraint(value, Relation.equalTo);
+  Constraint equals(_EquationMember value) {
+    return _createConstraint(value, Relation.equalTo);
+  }
 
   @override
   Expression operator +(_EquationMember m) {
-    if (m is ConstantMember) {
-      return new Expression(new List.from(terms), constant + m.value);
-    }
+    if (m is ConstantMember)
+      return new Expression(new List<Term>.from(terms), constant + m.value);
 
     if (m is Param) {
       return new Expression(
-          new List.from(terms)..add(new Term(m.variable, 1.0)), constant);
+        new List<Term>.from(terms)..add(new Term(m.variable, 1.0)),
+        constant
+      );
     }
 
-    if (m is Term) {
-      return new Expression(new List.from(terms)..add(m), constant);
-    }
+    if (m is Term)
+      return new Expression(new List<Term>.from(terms)..add(m), constant);
 
     if (m is Expression) {
       return new Expression(
-          new List.from(terms)..addAll(m.terms), constant + m.constant);
+        new List<Term>.from(terms)..addAll(m.terms),
+        constant + m.constant
+      );
     }
-
     assert(false);
     return null;
   }
 
   @override
   Expression operator -(_EquationMember m) {
-    if (m is ConstantMember) {
-      return new Expression(new List.from(terms), constant - m.value);
-    }
+    if (m is ConstantMember)
+      return new Expression(new List<Term>.from(terms), constant - m.value);
 
     if (m is Param) {
       return new Expression(
-          new List.from(terms)..add(new Term(m.variable, -1.0)), constant);
+        new List<Term>.from(terms)..add(new Term(m.variable, -1.0)),
+        constant
+      );
     }
 
     if (m is Term) {
-      return new Expression(new List.from(terms)
+      return new Expression(new List<Term>.from(terms)
         ..add(new Term(m.variable, -m.coefficient)), constant);
     }
 
     if (m is Expression) {
-      var copiedTerms = new List<Term>.from(terms);
-      m.terms.forEach(
-          (t) => copiedTerms.add(new Term(t.variable, -t.coefficient)));
+      List<Term> copiedTerms = new List<Term>.from(terms);
+      for (Term t in m.terms)
+        copiedTerms.add(new Term(t.variable, -t.coefficient));
       return new Expression(copiedTerms, constant - m.constant);
     }
-
     assert(false);
     return null;
   }
 
   _EquationMember _applyMultiplicand(double m) {
-    var newTerms = terms.fold(new List<Term>(), (list, term) => list
-      ..add(new Term(term.variable, term.coefficient * m)));
+    List<Term> newTerms = terms.fold(
+      new List<Term>(),
+      (List<Term> list, Term term) {
+        return list..add(new Term(term.variable, term.coefficient * m));
+      }
+    );
     return new Expression(newTerms, constant * m);
   }
 
@@ -127,17 +140,14 @@
     // At least on of the the two members must be constant for the resulting
     // expression to be linear
 
-    if (!this.isConstant && !m.isConstant) {
+    if (!this.isConstant && !m.isConstant)
       return null;
-    }
 
-    if (this.isConstant) {
-      return new _Pair(m.asExpression(), this.value);
-    }
+    if (this.isConstant)
+      return new _Pair<Expression, double>(m.asExpression(), this.value);
 
-    if (m.isConstant) {
-      return new _Pair(this.asExpression(), m.value);
-    }
+    if (m.isConstant)
+      return new _Pair<Expression, double>(this.asExpression(), m.value);
 
     assert(false);
     return null;
@@ -148,8 +158,9 @@
 
     if (args == null) {
       throw new ParserException(
-          'Could not find constant multiplicand or multiplier', [this, m]);
-      return null;
+        'Could not find constant multiplicand or multiplier',
+        <_EquationMember>[this, m]
+      );
     }
 
     return args.first._applyMultiplicand(args.second);
@@ -168,7 +179,7 @@
   String toString() {
     StringBuffer buffer = new StringBuffer();
 
-    terms.forEach((t) => buffer.write('$t'));
+    terms.forEach((Term t) => buffer.write('$t'));
 
     if (constant != 0.0) {
       buffer.write(constant.sign > 0.0 ? '+' : '-');
diff --git a/packages/cassowary/lib/param.dart b/packages/cassowary/lib/param.dart
index 81d3496..cd912f4 100644
--- a/packages/cassowary/lib/param.dart
+++ b/packages/cassowary/lib/param.dart
@@ -5,19 +5,19 @@
 part of cassowary;
 
 class Param extends _EquationMember {
-  final Variable variable;
-  dynamic context;
-
   Param([double value = 0.0]) : variable = new Variable(value) {
     variable._owner = this;
   }
-
-  Param.withContext(ctx, [double value = 0.0])
-      : variable = new Variable(value),
-        context = ctx {
+  Param.withContext(dynamic context, [double value = 0.0])
+    : variable = new Variable(value),
+      context = context {
     variable._owner = this;
   }
 
+  final Variable variable;
+
+  dynamic context;
+
   bool get isConstant => false;
 
   double get value => variable.value;
@@ -25,5 +25,5 @@
   String get name => variable.name;
   void set name(String name) { variable.name = name; }
 
-  Expression asExpression() => new Expression([new Term(variable, 1.0)], 0.0);
+  Expression asExpression() => new Expression(<Term>[new Term(variable, 1.0)], 0.0);
 }
diff --git a/packages/cassowary/lib/row.dart b/packages/cassowary/lib/row.dart
index 49b8fb9..d9806e9 100644
--- a/packages/cassowary/lib/row.dart
+++ b/packages/cassowary/lib/row.dart
@@ -27,7 +27,7 @@
 
   void insertRow(_Row other, [double coefficient = 1.0]) {
     constant += other.constant * coefficient;
-    other.cells.forEach((s, v) => insertSymbol(s, v * coefficient));
+    other.cells.forEach((_Symbol s, double v) => insertSymbol(s, v * coefficient));
   }
 
   void removeSymbol(_Symbol symbol) {
@@ -36,7 +36,7 @@
 
   void reverseSign() {
     constant = -constant;
-    cells.forEach((s, v) => cells[s] = -v);
+    cells.forEach((_Symbol s, double v) => cells[s] = -v);
   }
 
   void solveForSymbol(_Symbol symbol) {
@@ -44,7 +44,7 @@
     double coefficient = -1.0 / cells[symbol];
     cells.remove(symbol);
     constant *= coefficient;
-    cells.forEach((s, v) => cells[s] = v * coefficient);
+    cells.forEach((_Symbol s, double v) => cells[s] = v * coefficient);
   }
 
   void solveForSymbols(_Symbol lhs, _Symbol rhs) {
@@ -70,8 +70,9 @@
 
     buffer.write(constant);
 
-    cells.forEach((symbol, value) =>
-        buffer.write(" + " + value.toString() + " * " + symbol.toString()));
+    cells.forEach((_Symbol symbol, double value) {
+      buffer.write(" + " + value.toString() + " * " + symbol.toString());
+    });
 
     return buffer.toString();
   }
diff --git a/packages/cassowary/lib/solver.dart b/packages/cassowary/lib/solver.dart
index 4e551cf..4688e9f 100644
--- a/packages/cassowary/lib/solver.dart
+++ b/packages/cassowary/lib/solver.dart
@@ -89,7 +89,7 @@
 
       _Symbol leaving = rowPair.first;
       row = rowPair.second;
-      var removed = _rows.remove(rowPair.first);
+      _Row removed = _rows.remove(rowPair.first);
       assert(removed != null);
       row.solveForSymbols(leaving, tag.marker);
       _substitute(tag.marker, row);
@@ -170,8 +170,8 @@
     return _dualOptimize();
   }
 
-  Set flushUpdates() {
-    Set updates = new HashSet<dynamic>();
+  Set<dynamic> flushUpdates() {
+    Set<dynamic> updates = new HashSet<dynamic>();
 
     for (Variable variable in _vars.keys) {
       _Symbol symbol = _vars[variable];
@@ -189,10 +189,12 @@
     return updates;
   }
 
-  Result _bulkEdit(Iterable items,
-                   _SolverBulkUpdate applier,
-                   _SolverBulkUpdate undoer) {
-    List applied = new List();
+  Result _bulkEdit(
+    Iterable<dynamic> items,
+    _SolverBulkUpdate applier,
+    _SolverBulkUpdate undoer
+  ) {
+    List<dynamic> applied = <dynamic>[];
     bool needsCleanup = false;
 
     Result result = Result.success;
@@ -231,7 +233,7 @@
     Expression expr = new Expression.fromExpression(constraint.expression);
     _Row row = new _Row(expr.constant);
 
-    expr.terms.forEach((term) {
+    expr.terms.forEach((Term term) {
       if (!_nearZero(term.coefficient)) {
         _Symbol symbol = _symbolForVariable(term.variable);
 
@@ -397,9 +399,9 @@
 
   _Pair<_Symbol, _Row> _leavingRowForEnteringSymbol(_Symbol entering) {
     double ratio = double.MAX_FINITE;
-    _Pair<_Symbol, _Row> result = new _Pair(null, null);
+    _Pair<_Symbol, _Row> result = new _Pair<_Symbol, _Row>(null, null);
 
-    _rows.forEach((symbol, row) {
+    _rows.forEach((_Symbol symbol, _Row row) {
       if (symbol.type != _SymbolType.external) {
         double temp = row.coefficientForSymbol(entering);
 
@@ -423,7 +425,7 @@
   }
 
   void _substitute(_Symbol symbol, _Row row) {
-    _rows.forEach((first, second) {
+    _rows.forEach((_Symbol first, _Row second) {
       second.substitute(symbol, row);
       if (first.type != _SymbolType.external && second.constant < 0.0) {
         _infeasibleRows.add(first);
@@ -470,7 +472,7 @@
 
     _Pair<_Symbol, _Row> first, second, third;
 
-    _rows.forEach((symbol, row) {
+    _rows.forEach((_Symbol symbol, _Row row) {
       double c = row.coefficientForSymbol(marker);
 
       if (c == 0.0) {
@@ -478,18 +480,18 @@
       }
 
       if (symbol.type == _SymbolType.external) {
-        third = new _Pair(symbol, row);
+        third = new _Pair<_Symbol, _Row>(symbol, row);
       } else if (c < 0.0) {
         double r = -row.constant / c;
         if (r < r1) {
           r1 = r;
-          first = new _Pair(symbol, row);
+          first = new _Pair<_Symbol, _Row>(symbol, row);
         }
       } else {
         double r = row.constant / c;
         if (r < r2) {
           r2 = r;
-          second = new _Pair(symbol, row);
+          second = new _Pair<_Symbol, _Row>(symbol, row);
         }
       }
     });
@@ -596,28 +598,33 @@
 
     // Tableau
     buffer.writeln(separator + " Tableau");
-    _rows.forEach((symbol, row) {
-      buffer.write(symbol.toString());
-      buffer.write(" | ");
-      buffer.writeln(row.toString());
+    _rows.forEach((_Symbol symbol, _Row row) {
+      buffer.writeln('$symbol | $row');
     });
 
     // Infeasible
     buffer.writeln(separator + " Infeasible");
-    _infeasibleRows.forEach((symbol) => buffer.writeln(symbol.toString()));
+    _infeasibleRows.forEach((_Symbol symbol) {
+      buffer.writeln(symbol);
+    });
 
     // Variables
     buffer.writeln(separator + " Variables");
-    _vars.forEach((variable, symbol) =>
-        buffer.writeln("${variable.toString()} = ${symbol.toString()}"));
+    _vars.forEach((Variable variable, _Symbol symbol) {
+      buffer.writeln('$variable = $symbol');
+    });
 
     // Edit Variables
     buffer.writeln(separator + " Edit Variables");
-    _edits.forEach((variable, editinfo) => buffer.writeln(variable));
+    _edits.forEach((Variable variable, _EditInfo editinfo) {
+      buffer.writeln(variable);
+    });
 
     // Constraints
     buffer.writeln(separator + " Constraints");
-    _constraints.forEach((constraint, _) => buffer.writeln(constraint));
+    _constraints.forEach((Constraint constraint, _Tag tag) {
+      buffer.writeln(constraint);
+    });
 
     return buffer.toString();
   }
diff --git a/packages/cassowary/test/cassowary_test.dart b/packages/cassowary/test/cassowary_test.dart
index 5a1b99b..145b0ce 100644
--- a/packages/cassowary/test/cassowary_test.dart
+++ b/packages/cassowary/test/cassowary_test.dart
@@ -10,34 +10,34 @@
 
 void main() {
   test('variable', () {
-    var v = new Param(22.0);
+    Param v = new Param(22.0);
     expect(v.value, 22);
   });
 
   test('variable1', () {
-    var v = new Param(22.0);
+    Param v = new Param(22.0);
     expect((v + cm(22.0)).value, 44.0);
     expect((v - cm(20.0)).value, 2.0);
   });
 
   test('term', () {
-    var t = new Term(new Variable(22.0), 2.0);
+    Term t = new Term(new Variable(22.0), 2.0);
     expect(t.value, 44);
   });
 
   test('expression', () {
-    var terms = [
+    List<Term> terms = <Term>[
       new Term(new Variable(22.0), 2.0),
       new Term(new Variable(1.0), 1.0),
     ];
-    var e = new Expression(terms, 40.0);
+    Expression e = new Expression(terms, 40.0);
     expect(e.value, 85.0);
   });
 
   test('expression1', () {
-    var v1 = new Param(10.0);
-    var v2 = new Param(10.0);
-    var v3 = new Param(22.0);
+    Param v1 = new Param(10.0);
+    Param v2 = new Param(10.0);
+    Param v3 = new Param(22.0);
 
     expect(v1 is Param, true);
     expect(v1 + cm(20.0) is Expression, true);
@@ -51,7 +51,7 @@
   });
 
   test('expression2', () {
-    var e = new Param(10.0) + cm(5.0);
+    Expression e = new Param(10.0) + cm(5.0);
     expect(e.value, 15.0);
     expect(e is Expression, true);
 
@@ -64,7 +64,7 @@
     expect(e.value, 15.0);
 
     // Param
-    var v = new Param(2.0);
+    Param v = new Param(2.0);
     expect((e + v) is Expression, true);
     expect((e + v).value, 17.0);
     expect((e - v) is Expression, true);
@@ -73,7 +73,7 @@
     expect(e.value, 15.0);
 
     // Term
-    var t = new Term(v.variable, 2.0);
+    Term t = new Term(v.variable, 2.0);
     expect((e + t) is Expression, true);
     expect((e + t).value, 19.0);
     expect((e - t) is Expression, true);
@@ -82,7 +82,7 @@
     expect(e.value, 15.0);
 
     // Expression
-    var e2 = new Param(7.0) + new Param(3.0);
+    Expression e2 = new Param(7.0) + new Param(3.0);
     expect((e + e2) is Expression, true);
     expect((e + e2).value, 25.0);
     expect((e - e2) is Expression, true);
@@ -92,31 +92,31 @@
   });
 
   test('term2', () {
-    var t = new Term(new Variable(12.0), 1.0);
+    Term t = new Term(new Variable(12.0), 1.0);
 
     // Constant
-    var c = cm(2.0);
+    ConstantMember c = cm(2.0);
     expect((t + c) is Expression, true);
     expect((t + c).value, 14.0);
     expect((t - c) is Expression, true);
     expect((t - c).value, 10.0);
 
     // Variable
-    var v = new Param(2.0);
+    Param v = new Param(2.0);
     expect((t + v) is Expression, true);
     expect((t + v).value, 14.0);
     expect((t - v) is Expression, true);
     expect((t - v).value, 10.0);
 
     // Term
-    var t2 = new Term(new Variable(1.0), 2.0);
+    Term t2 = new Term(new Variable(1.0), 2.0);
     expect((t + t2) is Expression, true);
     expect((t + t2).value, 14.0);
     expect((t - t2) is Expression, true);
     expect((t - t2).value, 10.0);
 
     // Expression
-    var exp = new Param(1.0) + cm(1.0);
+    Expression exp = new Param(1.0) + cm(1.0);
     expect((t + exp) is Expression, true);
     expect((t + exp).value, 14.0);
     expect((t - exp) is Expression, true);
@@ -124,31 +124,31 @@
   });
 
   test('variable3', () {
-    var v = new Param(3.0);
+    Param v = new Param(3.0);
 
     // Constant
-    var c = cm(2.0);
+    ConstantMember c = cm(2.0);
     expect((v + c) is Expression, true);
     expect((v + c).value, 5.0);
     expect((v - c) is Expression, true);
     expect((v - c).value, 1.0);
 
     // Variable
-    var v2 = new Param(2.0);
+    Param v2 = new Param(2.0);
     expect((v + v2) is Expression, true);
     expect((v + v2).value, 5.0);
     expect((v - v2) is Expression, true);
     expect((v - v2).value, 1.0);
 
     // Term
-    var t2 = new Term(new Variable(1.0), 2.0);
+    Term t2 = new Term(new Variable(1.0), 2.0);
     expect((v + t2) is Expression, true);
     expect((v + t2).value, 5.0);
     expect((v - t2) is Expression, true);
     expect((v - t2).value, 1.0);
 
     // Expression
-    var exp = new Param(1.0) + cm(1.0);
+    Expression exp = new Param(1.0) + cm(1.0);
     expect(exp.terms.length, 1);
 
     expect((v + exp) is Expression, true);
@@ -158,31 +158,31 @@
   });
 
   test('constantmember', () {
-    var c = cm(3.0);
+    ConstantMember c = cm(3.0);
 
     // Constant
-    var c2 = cm(2.0);
+    ConstantMember c2 = cm(2.0);
     expect((c + c2) is Expression, true);
     expect((c + c2).value, 5.0);
     expect((c - c2) is Expression, true);
     expect((c - c2).value, 1.0);
 
     // Variable
-    var v2 = new Param(2.0);
+    Param v2 = new Param(2.0);
     expect((c + v2) is Expression, true);
     expect((c + v2).value, 5.0);
     expect((c - v2) is Expression, true);
     expect((c - v2).value, 1.0);
 
     // Term
-    var t2 = new Term(new Variable(1.0), 2.0);
+    Term t2 = new Term(new Variable(1.0), 2.0);
     expect((c + t2) is Expression, true);
     expect((c + t2).value, 5.0);
     expect((c - t2) is Expression, true);
     expect((c - t2).value, 1.0);
 
     // Expression
-    var exp = new Param(1.0) + cm(1.0);
+    Expression exp = new Param(1.0) + cm(1.0);
 
     expect((c + exp) is Expression, true);
     expect((c + exp).value, 5.0);
@@ -191,74 +191,74 @@
   });
 
   test('constraint2', () {
-    var left = new Param(10.0);
-    var right = new Param(100.0);
+    Param left = new Param(10.0);
+    Param right = new Param(100.0);
 
-    var c = right - left >= cm(25.0);
+    Constraint c = right - left >= cm(25.0);
     expect(c is Constraint, true);
   });
 
   test('simple_multiplication', () {
     // Constant
-    var c = cm(20.0);
+    ConstantMember c = cm(20.0);
     expect((c * cm(2.0)).value, 40.0);
 
     // Variable
-    var v = new Param(20.0);
+    Param v = new Param(20.0);
     expect((v * cm(2.0)).value, 40.0);
 
     // Term
-    var t = new Term(v.variable, 1.0);
+    Term t = new Term(v.variable, 1.0);
     expect((t * cm(2.0)).value, 40.0);
 
     // Expression
-    var e = new Expression([t], 0.0);
+    Expression e = new Expression([t], 0.0);
     expect((e * cm(2.0)).value, 40.0);
   });
 
   test('simple_division', () {
     // Constant
-    var c = cm(20.0);
+    ConstantMember c = cm(20.0);
     expect((c / cm(2.0)).value, 10.0);
 
     // Variable
-    var v = new Param(20.0);
+    Param v = new Param(20.0);
     expect((v / cm(2.0)).value, 10.0);
 
     // Term
-    var t = new Term(v.variable, 1.0);
+    Term t = new Term(v.variable, 1.0);
     expect((t / cm(2.0)).value, 10.0);
 
     // Expression
-    var e = new Expression([t], 0.0);
+    Expression e = new Expression([t], 0.0);
     expect((e / cm(2.0)).value, 10.0);
   });
 
   test('full_constraints_setup', () {
-    var left = new Param(2.0);
-    var right = new Param(10.0);
+    Param left = new Param(2.0);
+    Param right = new Param(10.0);
 
-    var c1 = right - left >= cm(20.0);
+    Constraint c1 = right - left >= cm(20.0);
     expect(c1 is Constraint, true);
     expect(c1.expression.constant, -20.0);
     expect(c1.relation, Relation.greaterThanOrEqualTo);
 
-    var c2 = (right - left).equals(cm(30.0));
+    Constraint c2 = (right - left).equals(cm(30.0));
     expect(c2 is Constraint, true);
     expect(c2.expression.constant, -30.0);
     expect(c2.relation, Relation.equalTo);
 
-    var c3 = right - left <= cm(30.0);
+    Constraint c3 = right - left <= cm(30.0);
     expect(c3 is Constraint, true);
     expect(c3.expression.constant, -30.0);
     expect(c3.relation, Relation.lessThanOrEqualTo);
   });
 
   test('constraint_strength_update', () {
-    var left = new Param(2.0);
-    var right = new Param(10.0);
+    Param left = new Param(2.0);
+    Param right = new Param(10.0);
 
-    var c = (right - left >= cm(200.0)) | 750.0;
+    Constraint c = (right - left >= cm(200.0)) | 750.0;
     expect(c is Constraint, true);
     expect(c.expression.terms.length, 2);
     expect(c.expression.constant, -200.0);
@@ -266,12 +266,12 @@
   });
 
   test('solver', () {
-    var s = new Solver();
+    Solver s = new Solver();
 
-    var left = new Param(2.0);
-    var right = new Param(100.0);
+    Param left = new Param(2.0);
+    Param right = new Param(100.0);
 
-    var c1 = right - left >= cm(200.0);
+    Constraint c1 = right - left >= cm(200.0);
 
     expect((right >= left) is Constraint, true);
 
@@ -279,28 +279,28 @@
   });
 
   test('constraint_complex', () {
-    var e = new Param(200.0) - new Param(100.0);
+    Expression e = new Param(200.0) - new Param(100.0);
 
     // Constant
-    var c1 = e >= cm(50.0);
+    Constraint c1 = e >= cm(50.0);
     expect(c1 is Constraint, true);
     expect(c1.expression.terms.length, 2);
     expect(c1.expression.constant, -50.0);
 
     // Variable
-    var c2 = e >= new Param(2.0);
+    Constraint c2 = e >= new Param(2.0);
     expect(c2 is Constraint, true);
     expect(c2.expression.terms.length, 3);
     expect(c2.expression.constant, 0.0);
 
     // Term
-    var c3 = e >= new Term(new Variable(2.0), 1.0);
+    Constraint c3 = e >= new Term(new Variable(2.0), 1.0);
     expect(c3 is Constraint, true);
     expect(c3.expression.terms.length, 3);
     expect(c3.expression.constant, 0.0);
 
     // Expression
-    var c4 = e >= new Expression([new Term(new Variable(2.0), 1.0)], 20.0);
+    Constraint c4 = e >= new Expression([new Term(new Variable(2.0), 1.0)], 20.0);
     expect(c4 is Constraint, true);
     expect(c4.expression.terms.length, 3);
     expect(c4.expression.constant, -20.0);
@@ -308,40 +308,40 @@
 
   test('constraint_complex_non_exprs', () {
     // Constant
-    var c1 = cm(100.0) >= cm(50.0);
+    Constraint c1 = cm(100.0) >= cm(50.0);
     expect(c1 is Constraint, true);
     expect(c1.expression.terms.length, 0);
     expect(c1.expression.constant, 50.0);
 
     // Variable
-    var c2 = new Param(100.0) >= new Param(2.0);
+    Constraint c2 = new Param(100.0) >= new Param(2.0);
     expect(c2 is Constraint, true);
     expect(c2.expression.terms.length, 2);
     expect(c2.expression.constant, 0.0);
 
     // Term
-    var t = new Term(new Variable(100.0), 1.0);
-    var c3 = t >= new Term(new Variable(2.0), 1.0);
+    Term t = new Term(new Variable(100.0), 1.0);
+    Constraint c3 = t >= new Term(new Variable(2.0), 1.0);
     expect(c3 is Constraint, true);
     expect(c3.expression.terms.length, 2);
     expect(c3.expression.constant, 0.0);
 
     // Expression
-    var e = new Expression([t], 0.0);
-    var c4 = e >= new Expression([new Term(new Variable(2.0), 1.0)], 20.0);
+    Expression e = new Expression([t], 0.0);
+    Constraint c4 = e >= new Expression([new Term(new Variable(2.0), 1.0)], 20.0);
     expect(c4 is Constraint, true);
     expect(c4.expression.terms.length, 2);
     expect(c4.expression.constant, -20.0);
   });
 
   test('constraint_update_in_solver', () {
-    var s = new Solver();
+    Solver s = new Solver();
 
-    var left = new Param(2.0);
-    var right = new Param(100.0);
+    Param left = new Param(2.0);
+    Param right = new Param(100.0);
 
-    var c1 = right - left >= cm(200.0);
-    var c2 = right >= right;
+    Constraint c1 = right - left >= cm(200.0);
+    Constraint c2 = right >= right;
 
     expect(s.addConstraint(c1), Result.success);
     expect(s.addConstraint(c1), Result.duplicateConstraint);
@@ -351,10 +351,10 @@
   });
 
   test('test_multiplication_division_override', () {
-    var c = cm(10.0);
-    var v = new Param(c.value);
-    var t = new Term(v.variable, 1.0);
-    var e = new Expression([t], 0.0);
+    ConstantMember c = cm(10.0);
+    Param v = new Param(c.value);
+    Term t = new Term(v.variable, 1.0);
+    Expression e = new Expression([t], 0.0);
 
     // Constant
     expect((c * cm(10.0)).value, 100);
@@ -382,10 +382,10 @@
   });
 
   test('test_multiplication_division_exceptions', () {
-    var c = cm(10.0);
-    var v = new Param(c.value);
-    var t = new Term(v.variable, 1.0);
-    var e = new Expression([t], 0.0);
+    ConstantMember c = cm(10.0);
+    Param v = new Param(c.value);
+    Term t = new Term(v.variable, 1.0);
+    Expression e = new Expression([t], 0.0);
 
     expect((c * c).value, 100);
     expect(() => v * v, throwsA(new isInstanceOf<ParserException>()));
@@ -401,9 +401,9 @@
   test('edit_updates', () {
     Solver s = new Solver();
 
-    var left = new Param(0.0);
-    var right = new Param(100.0);
-    var mid = new Param(0.0);
+    Param left = new Param(0.0);
+    Param right = new Param(100.0);
+    Param mid = new Param(0.0);
 
     Constraint c = left + right >= cm(2.0) * mid;
     expect(s.addConstraint(c), Result.success);
@@ -416,15 +416,15 @@
   });
 
   test('bug1', () {
-    var left = new Param(0.0);
-    var right = new Param(100.0);
-    var mid = new Param(0.0);
+    Param left = new Param(0.0);
+    Param right = new Param(100.0);
+    Param mid = new Param(0.0);
 
     expect(((left + right) >= (cm(2.0) * mid)) is Constraint, true);
   });
 
   test('single_item', () {
-    var left = new Param(-20.0);
+    Param left = new Param(-20.0);
     Solver s = new Solver();
     s.addConstraint(left >= cm(0.0));
     s.flushUpdates();
@@ -432,9 +432,9 @@
   });
 
   test('midpoints', () {
-    var left = new Param(0.0)..name = "left";
-    var right = new Param(0.0)..name = "right";
-    var mid = new Param(0.0)..name = "mid";
+    Param left = new Param(0.0)..name = "left";
+    Param right = new Param(0.0)..name = "right";
+    Param mid = new Param(0.0)..name = "mid";
 
     Solver s = new Solver();
 
@@ -451,13 +451,13 @@
   });
 
   test('addition_of_multiple', () {
-    var left = new Param(0.0);
-    var right = new Param(0.0);
-    var mid = new Param(0.0);
+    Param left = new Param(0.0);
+    Param right = new Param(0.0);
+    Param mid = new Param(0.0);
 
     Solver s = new Solver();
 
-    var c = (left >= cm(0.0));
+    Constraint c = (left >= cm(0.0));
 
     expect(s.addConstraints([
       (left + right).equals(cm(2.0) * mid),
@@ -470,9 +470,9 @@
   });
 
   test('edit_constraints', () {
-    var left = new Param(0.0)..name = "left";
-    var right = new Param(0.0)..name = "right";
-    var mid = new Param(0.0)..name = "mid";
+    Param left = new Param(0.0)..name = "left";
+    Param right = new Param(0.0)..name = "right";
+    Param mid = new Param(0.0)..name = "mid";
 
     Solver s = new Solver();
 
@@ -492,11 +492,11 @@
   });
 
   test('test_description', () {
-    var left = new Param(0.0);
-    var right = new Param(100.0);
-    var c1 = right >= left;
-    var c2 = right <= left;
-    var c3 = right.equals(left);
+    Param left = new Param(0.0);
+    Param right = new Param(100.0);
+    Constraint c1 = right >= left;
+    Constraint c2 = right <= left;
+    Constraint c3 = right.equals(left);
 
     Solver s = new Solver();
     expect(s.addConstraint(c1), Result.success);
@@ -547,7 +547,7 @@
 
     expect(s.suggestValueForVariable(mid.variable, 50.0), Result.success);
 
-    var updates = s.flushUpdates();
+    Set<dynamic> updates = s.flushUpdates();
 
     expect(updates.length, 2);
 
@@ -571,7 +571,7 @@
 
     expect(s.suggestValueForVariable(mid.variable, 50.0), Result.success);
 
-    var updates = s.flushUpdates();
+    Set<dynamic> updates = s.flushUpdates();
 
     expect(updates.length, 1);
 
@@ -581,7 +581,7 @@
   });
 
   test('param_context_non_final', () {
-    var p = new Param.withContext("a");
+    Param p = new Param.withContext("a");
     p.context = "b";
     expect(p.context, "b");
   });
@@ -596,9 +596,9 @@
   test('bulk_add_edit_variables', () {
     Solver s = new Solver();
 
-    var left = new Param(0.0);
-    var right = new Param(100.0);
-    var mid = new Param(0.0);
+    Param left = new Param(0.0);
+    Param right = new Param(100.0);
+    Param mid = new Param(0.0);
 
     expect(s.addEditVariables(
          [left.variable, right.variable, mid.variable], 999.0), Result.success);
@@ -607,15 +607,15 @@
   test('bulk_remove_constraints_and_variables', () {
     Solver s = new Solver();
 
-    var left = new Param(0.0);
-    var right = new Param(100.0);
-    var mid = new Param(0.0);
+    Param left = new Param(0.0);
+    Param right = new Param(100.0);
+    Param mid = new Param(0.0);
 
     expect(s.addEditVariables(
          [left.variable, right.variable, mid.variable], 999.0), Result.success);
 
-    var c1 = left <= mid;
-    var c2 = mid <= right;
+    Constraint c1 = left <= mid;
+    Constraint c2 = mid <= right;
 
     expect(s.addConstraints([c1, c2]), Result.success);
 
diff --git a/packages/flutter/lib/src/animation/animation_controller.dart b/packages/flutter/lib/src/animation/animation_controller.dart
index 205ecd4..4df50f1 100644
--- a/packages/flutter/lib/src/animation/animation_controller.dart
+++ b/packages/flutter/lib/src/animation/animation_controller.dart
@@ -125,7 +125,7 @@
   }
 
   /// Starts running this animation forwards (towards the end).
-  Future forward({ double from }) {
+  Future<Null> forward({ double from }) {
     if (from != null)
       value = from;
     _direction = _AnimationDirection.forward;
@@ -133,7 +133,7 @@
   }
 
   /// Starts running this animation in reverse (towards the beginning).
-  Future reverse({ double from }) {
+  Future<Null> reverse({ double from }) {
     if (from != null)
       value = from;
     _direction = _AnimationDirection.reverse;
@@ -141,7 +141,7 @@
   }
 
   /// Drives the animation from its current value to target.
-  Future animateTo(double target, { Duration duration, Curve curve: Curves.linear }) {
+  Future<Null> animateTo(double target, { Duration duration, Curve curve: Curves.linear }) {
     Duration simulationDuration = duration;
     if (simulationDuration == null) {
       double range = upperBound - lowerBound;
@@ -152,7 +152,7 @@
     if (simulationDuration == Duration.ZERO) {
       assert(value == target);
       _checkStatusChanged();
-      return new Future.value();
+      return new Future<Null>.value();
     }
     assert(simulationDuration > Duration.ZERO);
     assert(!isAnimating);
@@ -163,7 +163,7 @@
   /// restarts the animation when it completes.
   ///
   /// Defaults to repeating between the lower and upper bounds.
-  Future repeat({ double min, double max, Duration period }) {
+  Future<Null> repeat({ double min, double max, Duration period }) {
     min ??= lowerBound;
     max ??= upperBound;
     period ??= duration;
@@ -173,24 +173,24 @@
   /// Flings the timeline with an optional force (defaults to a critically
   /// damped spring) and initial velocity. If velocity is positive, the
   /// animation will complete, otherwise it will dismiss.
-  Future fling({ double velocity: 1.0, Force force }) {
+  Future<Null> fling({ double velocity: 1.0, Force force }) {
     force ??= kDefaultSpringForce;
     _direction = velocity < 0.0 ? _AnimationDirection.reverse : _AnimationDirection.forward;
     return animateWith(force.release(value, velocity));
   }
 
   /// Drives the animation according to the given simulation.
-  Future animateWith(Simulation simulation) {
+  Future<Null> animateWith(Simulation simulation) {
     stop();
     return _startSimulation(simulation);
   }
 
-  Future _startSimulation(Simulation simulation) {
+  Future<Null> _startSimulation(Simulation simulation) {
     assert(simulation != null);
     assert(!isAnimating);
     _simulation = simulation;
     _value = simulation.x(0.0).clamp(lowerBound, upperBound);
-    Future result = _ticker.start();
+    Future<Null> result = _ticker.start();
     _checkStatusChanged();
     return result;
   }
diff --git a/packages/flutter/lib/src/http/http.dart b/packages/flutter/lib/src/http/http.dart
index 7e3f24d..3d28a3d 100644
--- a/packages/flutter/lib/src/http/http.dart
+++ b/packages/flutter/lib/src/http/http.dart
@@ -145,6 +145,6 @@
   return _withClient/*<Uint8List>*/((MojoClient client) => client.readBytes(url, headers: headers));
 }
 
-Future/*<T>*/ _withClient/*<T>*/(Future/*<T>*/ fn(MojoClient client)) {
+Future<dynamic/*=T*/> _withClient/*<T>*/(Future<dynamic/*=T*/> fn(MojoClient client)) {
   return fn(new MojoClient());
 }
diff --git a/packages/flutter/lib/src/material/app.dart b/packages/flutter/lib/src/material/app.dart
index d958ee7..1d2a48c 100644
--- a/packages/flutter/lib/src/material/app.dart
+++ b/packages/flutter/lib/src/material/app.dart
@@ -45,7 +45,7 @@
     onGenerateRoute: (RouteSettings settings) {
       RouteBuilder builder = routes[settings.name];
       if (builder != null) {
-        return new MaterialPageRoute(
+        return new MaterialPageRoute<Null>(
           builder: (BuildContext context) {
             return builder(new RouteArguments(context: context));
           },
diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart
index b92e671..c27989e 100644
--- a/packages/flutter/lib/src/material/bottom_sheet.dart
+++ b/packages/flutter/lib/src/material/bottom_sheet.dart
@@ -44,7 +44,7 @@
 
 class _BottomSheetState extends State<BottomSheet> {
 
-  final _childKey = new GlobalKey(debugLabel: 'BottomSheet child');
+  final GlobalKey _childKey = new GlobalKey(debugLabel: 'BottomSheet child');
 
   double get _childHeight {
     final RenderBox renderBox = _childKey.currentContext.findRenderObject();
@@ -117,15 +117,15 @@
   }
 }
 
-class _ModalBottomSheet extends StatefulComponent {
+class _ModalBottomSheet<T> extends StatefulComponent {
   _ModalBottomSheet({ Key key, this.route }) : super(key: key);
 
-  final _ModalBottomSheetRoute route;
+  final _ModalBottomSheetRoute<T> route;
 
-  _ModalBottomSheetState createState() => new _ModalBottomSheetState();
+  _ModalBottomSheetState<T> createState() => new _ModalBottomSheetState<T>();
 }
 
-class _ModalBottomSheetState extends State<_ModalBottomSheet> {
+class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
   Widget build(BuildContext context) {
     return new GestureDetector(
       onTap: () => Navigator.pop(context),
@@ -165,15 +165,15 @@
   }
 
   Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation) {
-    return new _ModalBottomSheet(route: this);
+    return new _ModalBottomSheet<T>(route: this);
   }
 }
 
-Future showModalBottomSheet({ BuildContext context, WidgetBuilder builder }) {
+Future<dynamic/*=T*/> showModalBottomSheet/*<T>*/({ BuildContext context, WidgetBuilder builder }) {
   assert(context != null);
   assert(builder != null);
-  final Completer completer = new Completer();
-  Navigator.push(context, new _ModalBottomSheetRoute(
+  final Completer<dynamic/*=T*/> completer = new Completer<dynamic/*=T*/>();
+  Navigator.push(context, new _ModalBottomSheetRoute<dynamic/*=T*/>(
     completer: completer,
     builder: builder
   ));
diff --git a/packages/flutter/lib/src/material/colors.dart b/packages/flutter/lib/src/material/colors.dart
index d106b04..102d5f2 100644
--- a/packages/flutter/lib/src/material/colors.dart
+++ b/packages/flutter/lib/src/material/colors.dart
@@ -9,20 +9,20 @@
 class Colors {
   Colors._();
 
-  static const transparent = const Color(0x00000000);
+  static const Color transparent = const Color(0x00000000);
 
-  static const black   = const Color(0xFF000000);
-  static const black87 = const Color(0xDD000000);
-  static const black54 = const Color(0x8A000000);
-  static const black45 = const Color(0x73000000); // mask color
-  static const black26 = const Color(0x42000000); // disabled radio buttons and text of disabled flat buttons in light theme
-  static const black12 = const Color(0x1F000000); // background of disabled raised buttons in light theme
+  static const Color black   = const Color(0xFF000000);
+  static const Color black87 = const Color(0xDD000000);
+  static const Color black54 = const Color(0x8A000000);
+  static const Color black45 = const Color(0x73000000); // mask color
+  static const Color black26 = const Color(0x42000000); // disabled radio buttons and text of disabled flat buttons in light theme
+  static const Color black12 = const Color(0x1F000000); // background of disabled raised buttons in light theme
 
-  static const white   = const Color(0xFFFFFFFF);
-  static const white70 = const Color(0xB3FFFFFF);
-  static const white30 = const Color(0x4DFFFFFF); // disabled radio buttons and text of disabled flat buttons in dark theme
-  static const white12 = const Color(0x1FFFFFFF); // background of disabled raised buttons in dark theme
-  static const white10 = const Color(0x1AFFFFFF);
+  static const Color white   = const Color(0xFFFFFFFF);
+  static const Color white70 = const Color(0xB3FFFFFF);
+  static const Color white30 = const Color(0x4DFFFFFF); // disabled radio buttons and text of disabled flat buttons in dark theme
+  static const Color white12 = const Color(0x1FFFFFFF); // background of disabled raised buttons in dark theme
+  static const Color white10 = const Color(0x1AFFFFFF);
 
   static const Map<int, Color> red = const <int, Color>{
      50: const Color(0xFFFFEBEE),
diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart
index 53bda7d..60b3d77 100644
--- a/packages/flutter/lib/src/material/dialog.dart
+++ b/packages/flutter/lib/src/material/dialog.dart
@@ -142,8 +142,8 @@
   }
 }
 
-Future showDialog({ BuildContext context, Widget child }) {
-  Completer completer = new Completer();
-  Navigator.push(context, new _DialogRoute(completer: completer, child: child));
+Future<dynamic/*=T*/> showDialog/*<T>*/({ BuildContext context, Widget child }) {
+  Completer<dynamic/*=T*/> completer = new Completer<int>(); // XXXXXXX MORE ANALYZER CHECKS 
+  Navigator.push(context, new _DialogRoute<dynamic/*=T*/>(completer: completer, child: child));
   return completer.future;
 }
diff --git a/packages/flutter/lib/src/material/drawer.dart b/packages/flutter/lib/src/material/drawer.dart
index 5a01d34..32d2d40 100644
--- a/packages/flutter/lib/src/material/drawer.dart
+++ b/packages/flutter/lib/src/material/drawer.dart
@@ -86,7 +86,7 @@
 
   void _ensureHistoryEntry() {
     if (_historyEntry == null) {
-      ModalRoute route = ModalRoute.of(context);
+      ModalRoute<dynamic> route = ModalRoute.of(context);
       if (route != null) {
         _historyEntry = new LocalHistoryEntry(onRemove: _handleHistoryEntryRemoved);
         route.addLocalHistoryEntry(_historyEntry);
diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart
index cb79e55..82c3b8d 100644
--- a/packages/flutter/lib/src/material/dropdown.dart
+++ b/packages/flutter/lib/src/material/dropdown.dart
@@ -154,7 +154,7 @@
   const _DropDownRouteResult(this.result);
   final T result;
   bool operator ==(dynamic other) {
-    if (other is! _DropDownRouteResult)
+    if (other is! _DropDownRouteResult<T>)
       return false;
     final _DropDownRouteResult<T> typedOther = other;
     return result == typedOther.result;
@@ -193,7 +193,7 @@
   }
 
   Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation) {
-    return new _DropDownMenu(route: this);
+    return new _DropDownMenu<T>(route: this);
   }
 }
 
@@ -269,7 +269,7 @@
   void _handleTap() {
     final RenderBox renderBox = indexedStackKey.currentContext.findRenderObject();
     final Rect rect = renderBox.localToGlobal(Point.origin) & renderBox.size;
-    final Completer completer = new Completer<_DropDownRouteResult<T>>();
+    final Completer<_DropDownRouteResult<T>> completer = new Completer<_DropDownRouteResult<T>>();
     Navigator.push(context, new _DropDownRoute<T>(
       completer: completer,
       items: config.items,
diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart
index 50393bd..fd72917 100644
--- a/packages/flutter/lib/src/material/ink_well.dart
+++ b/packages/flutter/lib/src/material/ink_well.dart
@@ -44,7 +44,7 @@
   final bool containedInWell;
   final BoxShape highlightShape;
 
-  _InkResponseState createState() => new _InkResponseState<InkResponse>();
+  _InkResponseState<InkResponse> createState() => new _InkResponseState<InkResponse>();
 }
 
 class _InkResponseState<T extends InkResponse> extends State<T> {
diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart
index 61801e5..4956be5 100644
--- a/packages/flutter/lib/src/material/material.dart
+++ b/packages/flutter/lib/src/material/material.dart
@@ -477,7 +477,7 @@
     super.dispose();
   }
 
-  void _paintHighlight(Canvas canvas, Rect rect, paint) {
+  void _paintHighlight(Canvas canvas, Rect rect, Paint paint) {
     if (shape == BoxShape.rectangle)
       canvas.drawRect(rect, paint);
     else
diff --git a/packages/flutter/lib/src/material/page.dart b/packages/flutter/lib/src/material/page.dart
index 1401a3c..b5c3d3b 100644
--- a/packages/flutter/lib/src/material/page.dart
+++ b/packages/flutter/lib/src/material/page.dart
@@ -54,7 +54,7 @@
 
   Duration get transitionDuration => kMaterialPageRouteTransitionDuration;
   Color get barrierColor => null;
-  bool canTransitionFrom(TransitionRoute nextRoute) => false;
+  bool canTransitionFrom(TransitionRoute<dynamic> nextRoute) => false;
 
   Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation) {
     Widget result = builder(context);
diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart
index d2699d1..5ba198d 100644
--- a/packages/flutter/lib/src/material/popup_menu.dart
+++ b/packages/flutter/lib/src/material/popup_menu.dart
@@ -65,7 +65,7 @@
   _PopupMenuItemState<PopupMenuItem<T>> createState() => new _PopupMenuItemState<PopupMenuItem<T>>();
 }
 
-class _PopupMenuItemState<T extends PopupMenuItem> extends State<T> {
+class _PopupMenuItemState<T extends PopupMenuItem<dynamic>> extends State<T> {
   // Override this to put something else in the menu entry.
   Widget buildChild() => config.child;
 
@@ -318,7 +318,7 @@
       constraints: new BoxConstraints(maxWidth: screenSize.width, maxHeight: screenSize.height),
       child: new CustomOneChildLayout(
         delegate: new _PopupMenuRouteLayout(position, selectedItemOffset),
-        child: new _PopupMenu(route: this)
+        child: new _PopupMenu<T>(route: this)
       )
     );
   }
@@ -329,17 +329,17 @@
 /// and the value of [position] implies where the left, center point of the
 /// highlighted item should appear. If [initialValue] is not specified then position
 /// implies the menu's origin.
-Future/*<T>*/ showMenu/*<T>*/({
+Future<dynamic/*=T*/> showMenu/*<T>*/({
   BuildContext context,
   ModalPosition position,
-  List<PopupMenuEntry/*<T>*/> items,
+  List<PopupMenuEntry<dynamic/*=T*/>> items,
   dynamic/*=T*/ initialValue,
   int elevation: 8
 }) {
   assert(context != null);
   assert(items != null && items.length > 0);
-  Completer completer = new Completer/*<T>*/();
-  Navigator.push(context, new _PopupMenuRoute/*<T>*/(
+  Completer<dynamic/*=T*/> completer = new Completer<dynamic/*=T*/>();
+  Navigator.push(context, new _PopupMenuRoute<dynamic/*=T*/>(
     completer: completer,
     position: position,
     items: items,
diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart
index fc47e1e..5955c8b 100644
--- a/packages/flutter/lib/src/material/progress_indicator.dart
+++ b/packages/flutter/lib/src/material/progress_indicator.dart
@@ -128,11 +128,11 @@
 }
 
 class _CircularProgressIndicatorPainter extends CustomPainter {
-  static const _kTwoPI = math.PI * 2.0;
-  static const _kEpsilon = .001;
+  static const double _kTwoPI = math.PI * 2.0;
+  static const double _kEpsilon = .001;
   // Canavs.drawArc(r, 0, 2*PI) doesn't draw anything, so just get close.
-  static const _kSweep = _kTwoPI - _kEpsilon;
-  static const _kStartAngle = -math.PI / 2.0;
+  static const double _kSweep = _kTwoPI - _kEpsilon;
+  static const double _kStartAngle = -math.PI / 2.0;
 
   const _CircularProgressIndicatorPainter({
     this.valueColor,
diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart
index 0937b58..25ea3a4 100644
--- a/packages/flutter/lib/src/material/scaffold.dart
+++ b/packages/flutter/lib/src/material/scaffold.dart
@@ -229,24 +229,24 @@
 
   // SNACKBAR API
 
-  Queue<ScaffoldFeatureController<SnackBar>> _snackBars = new Queue<ScaffoldFeatureController<SnackBar>>();
+  Queue<ScaffoldFeatureController<SnackBar, Null>> _snackBars = new Queue<ScaffoldFeatureController<SnackBar, Null>>();
   AnimationController _snackBarController;
   Timer _snackBarTimer;
 
-  ScaffoldFeatureController showSnackBar(SnackBar snackbar) {
+  ScaffoldFeatureController<SnackBar, Null> showSnackBar(SnackBar snackbar) {
     _snackBarController ??= SnackBar.createAnimationController()
       ..addStatusListener(_handleSnackBarStatusChange);
     if (_snackBars.isEmpty) {
       assert(_snackBarController.isDismissed);
       _snackBarController.forward();
     }
-    ScaffoldFeatureController<SnackBar> controller;
-    controller = new ScaffoldFeatureController<SnackBar>._(
+    ScaffoldFeatureController<SnackBar, Null> controller;
+    controller = new ScaffoldFeatureController<SnackBar, Null>._(
       // We provide a fallback key so that if back-to-back snackbars happen to
       // match in structure, material ink splashes and highlights don't survive
       // from one to the next.
       snackbar.withAnimation(_snackBarController, fallbackKey: new UniqueKey()),
-      new Completer(),
+      new Completer<Null>(),
       () {
         assert(_snackBars.first == controller);
         _hideSnackBar();
@@ -294,14 +294,14 @@
   // PERSISTENT BOTTOM SHEET API
 
   List<Widget> _dismissedBottomSheets;
-  ScaffoldFeatureController _currentBottomSheet;
+  PersistentBottomSheetController<Null> _currentBottomSheet;
 
-  ScaffoldFeatureController showBottomSheet(WidgetBuilder builder) {
+  PersistentBottomSheetController<dynamic/*=T*/> showBottomSheet/*<T>*/(WidgetBuilder builder) {
     if (_currentBottomSheet != null) {
       _currentBottomSheet.close();
       assert(_currentBottomSheet == null);
     }
-    Completer completer = new Completer();
+    Completer<dynamic/*=T*/> completer = new Completer<dynamic/*=T*/>();
     GlobalKey<_PersistentBottomSheetState> bottomSheetKey = new GlobalKey<_PersistentBottomSheetState>();
     AnimationController controller = BottomSheet.createAnimationController()
       ..forward();
@@ -334,7 +334,7 @@
     );
     ModalRoute.of(context).addLocalHistoryEntry(entry);
     setState(() {
-      _currentBottomSheet = new ScaffoldFeatureController._(
+      _currentBottomSheet = new PersistentBottomSheetController<dynamic/*=T*/>._(
         bottomSheet,
         completer,
         () => entry.remove(),
@@ -447,7 +447,7 @@
     } else if (_scrollOffset > appBarHeight) {
       // scrolled down, show the "floating" toolbar
       _floatingAppBarHeight = (_floatingAppBarHeight + _scrollOffsetDelta).clamp(0.0, toolBarHeight);
-      final toolBarOpacity = _toolBarOpacity(_floatingAppBarHeight / toolBarHeight);
+      final double toolBarOpacity = _toolBarOpacity(_floatingAppBarHeight / toolBarHeight);
       _appBarController.value = (appBarHeight - _floatingAppBarHeight) / appBarHeight;
       appBar = new SizedBox(
         height: _floatingAppBarHeight,
@@ -471,7 +471,7 @@
     EdgeDims padding = MediaQuery.of(context)?.padding ?? EdgeDims.zero;
 
     if (_snackBars.length > 0) {
-      ModalRoute route = ModalRoute.of(context);
+      ModalRoute<dynamic> route = ModalRoute.of(context);
       if (route == null || route.isCurrent) {
         if (_snackBarController.isCompleted && _snackBarTimer == null)
           _snackBarTimer = new Timer(_snackBars.first._widget.duration, _hideSnackBar);
@@ -563,11 +563,11 @@
   }
 }
 
-class ScaffoldFeatureController<T extends Widget> {
+class ScaffoldFeatureController<T extends Widget, U> {
   const ScaffoldFeatureController._(this._widget, this._completer, this.close, this.setState);
   final T _widget;
-  final Completer _completer;
-  Future get closed => _completer.future;
+  final Completer<U> _completer;
+  Future<U> get closed => _completer.future;
   final VoidCallback close; // call this to close the bottom sheet or snack bar
   final StateSetter setState;
 }
@@ -641,3 +641,15 @@
   }
 
 }
+
+/// A [ScaffoldFeatureController] for persistent bottom sheets.
+///
+/// This is the type of objects returned by [Scaffold.showBottomSheet].
+class PersistentBottomSheetController<T> extends ScaffoldFeatureController<_PersistentBottomSheet, T> {
+  const PersistentBottomSheetController._(
+    _PersistentBottomSheet widget,
+    Completer<T> completer,
+    VoidCallback close,
+    StateSetter setState
+  ) : super._(widget, completer, close, setState);
+}
diff --git a/packages/flutter/lib/src/material/scrollbar_painter.dart b/packages/flutter/lib/src/material/scrollbar_painter.dart
index 4eb4858..4b89a46 100644
--- a/packages/flutter/lib/src/material/scrollbar_painter.dart
+++ b/packages/flutter/lib/src/material/scrollbar_painter.dart
@@ -60,7 +60,7 @@
 
   AnimationController _fade;
 
-  Future scrollStarted() {
+  Future<Null> scrollStarted() {
     if (_fade == null) {
       _fade = new AnimationController(duration: _kScrollbarThumbFadeDuration);
       CurvedAnimation curve = new CurvedAnimation(parent: _fade, curve: Curves.ease);
@@ -72,7 +72,7 @@
     return _fade.forward();
   }
 
-  Future scrollEnded() {
+  Future<Null> scrollEnded() {
     return _fade.reverse();
   }
 
diff --git a/packages/flutter/lib/src/material/switch.dart b/packages/flutter/lib/src/material/switch.dart
index 86d0108..4a7461e 100644
--- a/packages/flutter/lib/src/material/switch.dart
+++ b/packages/flutter/lib/src/material/switch.dart
@@ -24,7 +24,7 @@
   Widget build(BuildContext context) {
     assert(debugCheckHasMaterial(context));
     ThemeData themeData = Theme.of(context);
-    final isDark = themeData.brightness == ThemeBrightness.dark;
+    final bool isDark = themeData.brightness == ThemeBrightness.dark;
 
     Color activeThumbColor = activeColor ?? themeData.accentColor;
     Color activeTrackColor = activeThumbColor.withAlpha(0x80);
diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart
index c2fe9a1..1c323c5 100644
--- a/packages/flutter/lib/src/material/tabs.dart
+++ b/packages/flutter/lib/src/material/tabs.dart
@@ -416,8 +416,8 @@
 
   TabBarSelectionState<T> createState() => new TabBarSelectionState<T>();
 
-  static TabBarSelectionState of(BuildContext context) {
-    return context.ancestorStateOfType(const TypeMatcher<TabBarSelectionState>());
+  static TabBarSelectionState<dynamic/*=T*/> of/*<T>*/(BuildContext context) {
+    return context.ancestorStateOfType(const TypeMatcher<TabBarSelectionState<dynamic/*=T*/>>());
   }
 }
 
@@ -449,7 +449,7 @@
     _initValueToIndex();
   }
 
-  void didUpdateConfig(TabBarSelection oldConfig) {
+  void didUpdateConfig(TabBarSelection<T> oldConfig) {
     super.didUpdateConfig(oldConfig);
     if (values != oldConfig.values)
       _initValueToIndex();
@@ -564,12 +564,12 @@
   final Map<T, TabLabel> labels;
   final bool isScrollable;
 
-  _TabBarState createState() => new _TabBarState();
+  _TabBarState<T> createState() => new _TabBarState<T>();
 }
 
 class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelectionAnimationListener {
 
-  TabBarSelectionState _selection;
+  TabBarSelectionState<T> _selection;
   bool _valueIsChanging = false;
 
   void _initSelection(TabBarSelectionState<T> selection) {
@@ -584,7 +584,7 @@
     _initSelection(TabBarSelection.of(context));
   }
 
-  void didUpdateConfig(TabBar oldConfig) {
+  void didUpdateConfig(TabBar<T> oldConfig) {
     super.didUpdateConfig(oldConfig);
     if (!config.isScrollable)
       scrollTo(0.0);
@@ -666,7 +666,7 @@
     return new Rect.fromLTRB(r.left, r.bottom, r.right, r.bottom + _kTabIndicatorHeight);
   }
 
-  ScrollBehavior createScrollBehavior() => new _TabsScrollBehavior();
+  ScrollBehavior<double, double> createScrollBehavior() => new _TabsScrollBehavior();
   _TabsScrollBehavior get scrollBehavior => super.scrollBehavior;
 
   double _centeredTabScrollOffset(int tabIndex) {
@@ -795,7 +795,7 @@
   }
 }
 
-class TabBarView extends PageableList {
+class TabBarView<T> extends PageableList {
   TabBarView({
     Key key,
     List<Widget> children
@@ -808,12 +808,12 @@
     assert(children.length > 1);
   }
 
-  _TabBarViewState createState() => new _TabBarViewState();
+  _TabBarViewState<T> createState() => new _TabBarViewState<T>();
 }
 
-class _TabBarViewState extends PageableListState<TabBarView> implements TabBarSelectionAnimationListener {
+class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements TabBarSelectionAnimationListener {
 
-  TabBarSelectionState _selection;
+  TabBarSelectionState<T> _selection;
   List<Widget> _items;
 
   int get _tabCount => config.children.length;
@@ -825,7 +825,7 @@
     return _boundedBehavior;
   }
 
-  void _initSelection(TabBarSelectionState selection) {
+  void _initSelection(TabBarSelectionState<T> selection) {
     _selection = selection;
     if (_selection != null) {
       _selection.registerAnimationListener(this);
@@ -838,7 +838,7 @@
     _initSelection(TabBarSelection.of(context));
   }
 
-  void didUpdateConfig(TabBarView oldConfig) {
+  void didUpdateConfig(TabBarView<T> oldConfig) {
     super.didUpdateConfig(oldConfig);
     if (_selection != null && config.children != oldConfig.children)
       _updateItemsForSelectedIndex(_selection.index);
@@ -931,15 +931,15 @@
       controller.value = scrollOffset / 2.0;
   }
 
-  Future fling(double scrollVelocity) {
+  Future<Null> fling(double scrollVelocity) {
     if (_selection == null || _selection.valueIsChanging)
-      return new Future.value();
+      return new Future<Null>.value();
 
     if (scrollVelocity.abs() > _kMinFlingVelocity) {
       final int selectionDelta = scrollVelocity.sign.truncate();
       final int targetIndex = (_selection.index + selectionDelta).clamp(0, _tabCount - 1);
       _selection.value = _selection.values[targetIndex];
-      return new Future.value();
+      return new Future<Null>.value();
     }
 
     final int selectionIndex = _selection.index;
@@ -947,16 +947,16 @@
     if (selectionIndex > 0 && settleIndex != 1) {
       final int targetIndex = (selectionIndex + (settleIndex == 2 ? 1 : -1)).clamp(0, _tabCount - 1);
       _selection.value = _selection.values[targetIndex];
-      return new Future.value();
+      return new Future<Null>.value();
     } else if (selectionIndex == 0 && settleIndex == 1) {
       _selection.value = _selection.values[1];
-      return new Future.value();
+      return new Future<Null>.value();
     }
     return settleScrollOffset();
   }
 
   Widget buildContent(BuildContext context) {
-    TabBarSelectionState newSelection = TabBarSelection.of(context);
+    TabBarSelectionState<T> newSelection = TabBarSelection.of(context);
     if (_selection != newSelection)
       _initSelection(newSelection);
     return new PageViewport(
@@ -972,7 +972,7 @@
 class TabPageSelector<T> extends StatelessComponent {
   const TabPageSelector({ Key key }) : super(key: key);
 
-  Widget _buildTabIndicator(TabBarSelectionState<T> selection, T tab, Animation animation, ColorTween selectedColor, ColorTween previousColor) {
+  Widget _buildTabIndicator(TabBarSelectionState<T> selection, T tab, Animation<double> animation, ColorTween selectedColor, ColorTween previousColor) {
     Color background;
     if (selection.valueIsChanging) {
       // The selection's animation is animating from previousValue to value.
@@ -998,7 +998,7 @@
   }
 
   Widget build(BuildContext context) {
-    final TabBarSelectionState selection = TabBarSelection.of(context);
+    final TabBarSelectionState<T> selection = TabBarSelection.of(context);
     final Color color = Theme.of(context).accentColor;
     final ColorTween selectedColor = new ColorTween(begin: Colors.transparent, end: color);
     final ColorTween previousColor = new ColorTween(begin: color, end: Colors.transparent);
diff --git a/packages/flutter/lib/src/material/theme.dart b/packages/flutter/lib/src/material/theme.dart
index bdd887d..f3c9efe 100644
--- a/packages/flutter/lib/src/material/theme.dart
+++ b/packages/flutter/lib/src/material/theme.dart
@@ -8,7 +8,7 @@
 
 export 'theme_data.dart' show ThemeData, ThemeBrightness;
 
-const kThemeAnimationDuration = const Duration(milliseconds: 200);
+const Duration kThemeAnimationDuration = const Duration(milliseconds: 200);
 
 /// Applies a theme to descendant widgets.
 class Theme extends InheritedWidget {
@@ -73,7 +73,7 @@
 class _AnimatedThemeState extends AnimatedWidgetBaseState<AnimatedTheme> {
   ThemeDataTween _data;
 
-  void forEachTween(TweenVisitor visitor) {
+  void forEachTween(TweenVisitor<dynamic> visitor) {
     // TODO(ianh): Use constructor tear-offs when it becomes possible
     _data = visitor(_data, config.data, (dynamic value) => new ThemeDataTween(begin: value));
     assert(_data != null);
diff --git a/packages/flutter/lib/src/painting/box_painter.dart b/packages/flutter/lib/src/painting/box_painter.dart
index 440d9f9..7739b01 100644
--- a/packages/flutter/lib/src/painting/box_painter.dart
+++ b/packages/flutter/lib/src/painting/box_painter.dart
@@ -27,7 +27,7 @@
   final double width;
 
   /// A black border side of zero width.
-  static const none = const BorderSide(width: 0.0);
+  static const BorderSide none = const BorderSide(width: 0.0);
 
   BorderSide copyWith({
     Color color,
diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart
index ab8b69b..248ef9c 100644
--- a/packages/flutter/lib/src/painting/text_painter.dart
+++ b/packages/flutter/lib/src/painting/text_painter.dart
@@ -197,7 +197,7 @@
 
   /// The minimum width at which to layout the text.
   double get minWidth => _paragraph.minWidth;
-  void set minWidth(value) {
+  void set minWidth(double value) {
     if (_paragraph.minWidth == value)
       return;
     _paragraph.minWidth = value;
@@ -206,7 +206,7 @@
 
   /// The maximum width at which to layout the text.
   double get maxWidth => _paragraph.maxWidth;
-  void set maxWidth(value) {
+  void set maxWidth(double value) {
     if (_paragraph.maxWidth == value)
       return;
     _paragraph.maxWidth = value;
@@ -215,7 +215,7 @@
 
   /// The minimum height at which to layout the text.
   double get minHeight => _paragraph.minHeight;
-  void set minHeight(value) {
+  void set minHeight(double value) {
     if (_paragraph.minHeight == value)
       return;
     _paragraph.minHeight = value;
@@ -224,7 +224,7 @@
 
   /// The maximum height at which to layout the text.
   double get maxHeight => _paragraph.maxHeight;
-  void set maxHeight(value) {
+  void set maxHeight(double value) {
     if (_paragraph.maxHeight == value)
       return;
     _paragraph.maxHeight = value;
diff --git a/packages/flutter/lib/src/rendering/basic_types.dart b/packages/flutter/lib/src/rendering/basic_types.dart
index 2beeee6..5d39c83 100644
--- a/packages/flutter/lib/src/rendering/basic_types.dart
+++ b/packages/flutter/lib/src/rendering/basic_types.dart
@@ -7,9 +7,9 @@
 /// A BitField over an enum (or other class whose values implement "index").
 /// Only the first 63 values of the enum can be used as indices.
 class BitField<T extends dynamic> {
-  static const _kSMIBits = 63; // see https://www.dartlang.org/articles/numeric-computation/#smis-and-mints
-  static const _kAllZeros = 0;
-  static const _kAllOnes = 0x7FFFFFFFFFFFFFFF; // 2^(_kSMIBits+1)-1
+  static const int _kSMIBits = 63; // see https://www.dartlang.org/articles/numeric-computation/#smis-and-mints
+  static const int _kAllZeros = 0;
+  static const int _kAllOnes = 0x7FFFFFFFFFFFFFFF; // 2^(_kSMIBits+1)-1
   BitField(this._length) : _bits = _kAllZeros {
     assert(_length <= _kSMIBits);
   }
diff --git a/packages/flutter/lib/src/rendering/editable_line.dart b/packages/flutter/lib/src/rendering/editable_line.dart
index e9ffd4a..4c07836 100644
--- a/packages/flutter/lib/src/rendering/editable_line.dart
+++ b/packages/flutter/lib/src/rendering/editable_line.dart
@@ -11,9 +11,9 @@
 import 'object.dart';
 import 'viewport.dart';
 
-const _kCaretGap = 1.0; // pixels
-const _kCaretHeightOffset = 2.0; // pixels
-const _kCaretWidth = 1.0; // pixels
+const double _kCaretGap = 1.0; // pixels
+const double _kCaretHeightOffset = 2.0; // pixels
+const double _kCaretWidth = 1.0; // pixels
 
 final String _kZeroWidthSpace = new String.fromCharCode(0x200B);
 
diff --git a/packages/flutter/lib/src/rendering/flex.dart b/packages/flutter/lib/src/rendering/flex.dart
index cfd8896..8012c45 100644
--- a/packages/flutter/lib/src/rendering/flex.dart
+++ b/packages/flutter/lib/src/rendering/flex.dart
@@ -561,7 +561,7 @@
 
       Paint markerPaint = new Paint()..color = const Color(0xE0FF0000);
       Paint highlightPaint = new Paint()..color = const Color(0x7FFF0000);
-      const kMarkerSize = 0.1;
+      const double kMarkerSize = 0.1;
       Rect markerRect, overflowRect;
       switch(direction) {
         case FlexDirection.horizontal:
diff --git a/packages/flutter/lib/src/rendering/proxy_box.dart b/packages/flutter/lib/src/rendering/proxy_box.dart
index f9c8ed8..70d04cb 100644
--- a/packages/flutter/lib/src/rendering/proxy_box.dart
+++ b/packages/flutter/lib/src/rendering/proxy_box.dart
@@ -756,7 +756,7 @@
   Rect getApproximateClipRect(Size size) => Point.origin & size;
   /// Returns true if the new instance will result in a different clip
   /// than the oldClipper instance.
-  bool shouldRepaint(CustomClipper oldClipper);
+  bool shouldRepaint(CustomClipper<T> oldClipper);
 }
 
 abstract class _RenderCustomClip<T> extends RenderProxyBox {
@@ -1100,13 +1100,13 @@
   }
 
   /// Concatenates a translation by (x, y, z) into the transform.
-  void translate(x, [double y = 0.0, double z = 0.0]) {
+  void translate(double x, [double y = 0.0, double z = 0.0]) {
     _transform.translate(x, y, z);
     markNeedsPaint();
   }
 
   /// Concatenates a scale into the transform.
-  void scale(x, [double y, double z]) {
+  void scale(double x, [double y, double z]) {
     _transform.scale(x, y, z);
     markNeedsPaint();
   }
diff --git a/packages/flutter/lib/src/rendering/shifted_box.dart b/packages/flutter/lib/src/rendering/shifted_box.dart
index 1eadc59..18f2154 100644
--- a/packages/flutter/lib/src/rendering/shifted_box.dart
+++ b/packages/flutter/lib/src/rendering/shifted_box.dart
@@ -176,7 +176,7 @@
         context.canvas.drawPath(path, paint);
         paint = new Paint()
           ..color = debugPaintPaddingInnerEdgeColor;
-        const kOutline = 2.0;
+        const double kOutline = 2.0;
         path = new Path()
           ..moveTo(offset.dx + math.max(padding.left - kOutline, 0.0), offset.dy + math.max(padding.top - kOutline, 0.0))
           ..lineTo(offset.dx + math.min(size.width - padding.right + kOutline, size.width), offset.dy + math.max(padding.top - kOutline, 0.0))
diff --git a/packages/flutter/lib/src/rendering/stack.dart b/packages/flutter/lib/src/rendering/stack.dart
index 0a09f49..8bf2f3e 100644
--- a/packages/flutter/lib/src/rendering/stack.dart
+++ b/packages/flutter/lib/src/rendering/stack.dart
@@ -198,7 +198,7 @@
          RenderBoxContainerDefaultsMixin<RenderBox, StackParentData> {
   RenderStackBase({
     List<RenderBox> children,
-    alignment: const FractionalOffset(0.0, 0.0)
+    FractionalOffset alignment: const FractionalOffset(0.0, 0.0)
   }) : _alignment = alignment {
     addAll(children);
   }
@@ -425,7 +425,7 @@
 class RenderStack extends RenderStackBase {
   RenderStack({
     List<RenderBox> children,
-    alignment: const FractionalOffset(0.0, 0.0)
+    FractionalOffset alignment: const FractionalOffset(0.0, 0.0)
   }) : super(
    children: children,
    alignment: alignment
@@ -444,7 +444,7 @@
 class RenderIndexedStack extends RenderStackBase {
   RenderIndexedStack({
     List<RenderBox> children,
-    alignment: const FractionalOffset(0.0, 0.0),
+    FractionalOffset alignment: const FractionalOffset(0.0, 0.0),
     int index: 0
   }) : _index = index, super(
    children: children,
diff --git a/packages/flutter/lib/src/scheduler/scheduler.dart b/packages/flutter/lib/src/scheduler/scheduler.dart
index 62223fc..4a32f86 100644
--- a/packages/flutter/lib/src/scheduler/scheduler.dart
+++ b/packages/flutter/lib/src/scheduler/scheduler.dart
@@ -106,7 +106,7 @@
     // Note that we inverse the priority.
     return -e1.priority.compareTo(e2.priority);
   }
-  final PriorityQueue _taskQueue = new HeapPriorityQueue<_TaskEntry>(_taskSorter);
+  final PriorityQueue<_TaskEntry> _taskQueue = new HeapPriorityQueue<_TaskEntry>(_taskSorter);
 
   /// Whether this scheduler already requested to be called from the event loop.
   bool _hasRequestedAnEventLoopCallback = false;
diff --git a/packages/flutter/lib/src/scheduler/ticker.dart b/packages/flutter/lib/src/scheduler/ticker.dart
index 03980cc..e6d453a 100644
--- a/packages/flutter/lib/src/scheduler/ticker.dart
+++ b/packages/flutter/lib/src/scheduler/ticker.dart
@@ -16,17 +16,17 @@
 
   final TickerCallback _onTick;
 
-  Completer _completer;
+  Completer<Null> _completer;
   int _animationId;
   Duration _startTime;
 
   /// Starts calling onTick once per animation frame.
   ///
   /// The returned future resolves once the ticker stops ticking.
-  Future start() {
+  Future<Null> start() {
     assert(!isTicking);
     assert(_startTime == null);
-    _completer = new Completer();
+    _completer = new Completer<Null>();
     _scheduleTick();
     return _completer.future;
   }
@@ -48,7 +48,7 @@
     // We take the _completer into a local variable so that isTicking is false
     // when we actually complete the future (isTicking uses _completer
     // to determine its state).
-    Completer localCompleter = _completer;
+    Completer<Null> localCompleter = _completer;
     _completer = null;
     assert(!isTicking);
     localCompleter.complete();
diff --git a/packages/flutter/lib/src/services/asset_bundle.dart b/packages/flutter/lib/src/services/asset_bundle.dart
index 2b82857..43df8f9 100644
--- a/packages/flutter/lib/src/services/asset_bundle.dart
+++ b/packages/flutter/lib/src/services/asset_bundle.dart
@@ -80,7 +80,7 @@
     return new MojoAssetBundle(bundle);
   }
 
-  static Future _fetchAndUnpackBundle(String relativeUrl, AssetBundleProxy bundle) async {
+  static Future<Null> _fetchAndUnpackBundle(String relativeUrl, AssetBundleProxy bundle) async {
     core.MojoDataPipeConsumer bundleData = (await fetchUrl(relativeUrl)).body;
     AssetUnpackerProxy unpacker = new AssetUnpackerProxy.unbound();
     shell.connectToService("mojo:asset_bundle", unpacker);
diff --git a/packages/flutter/lib/src/services/image_cache.dart b/packages/flutter/lib/src/services/image_cache.dart
index 74a9aff..cf06a5d 100644
--- a/packages/flutter/lib/src/services/image_cache.dart
+++ b/packages/flutter/lib/src/services/image_cache.dart
@@ -36,8 +36,11 @@
     );
   }
 
-  bool operator ==(other) {
-    return other is _UrlFetcher && _url == other._url && _scale == other._scale;
+  bool operator ==(dynamic other) {
+    if (other is! _UrlFetcher)
+      return false;
+    final _UrlFetcher typedOther = other;
+    return _url == typedOther._url && _scale == typedOther._scale;
   }
 
   int get hashCode => hashValues(_url, _scale);
diff --git a/packages/flutter/lib/src/services/image_resource.dart b/packages/flutter/lib/src/services/image_resource.dart
index c3a5b59..cc8e008 100644
--- a/packages/flutter/lib/src/services/image_resource.dart
+++ b/packages/flutter/lib/src/services/image_resource.dart
@@ -24,7 +24,12 @@
 /// or because the underlying image resource was mutated.
 class ImageResource {
   ImageResource(this._futureImage) {
-    _futureImage.then(_handleImageLoaded, onError: (exception, stack) => _handleImageError('Failed to load image:', exception, stack));
+    _futureImage.then(
+      _handleImageLoaded,
+      onError: (dynamic exception, dynamic stack) {
+        _handleImageError('Failed to load image:', exception, stack);
+      }
+    );
   }
 
   bool _resolved = false;
diff --git a/packages/flutter/lib/src/widgets/asset_vendor.dart b/packages/flutter/lib/src/widgets/asset_vendor.dart
index 69febf8..9ff288f 100644
--- a/packages/flutter/lib/src/widgets/asset_vendor.dart
+++ b/packages/flutter/lib/src/widgets/asset_vendor.dart
@@ -86,9 +86,9 @@
   // one.
   Map<String, List<String>> _assetManifest;
 
-  Future _initializer;
+  Future<Null> _initializer;
 
-  Future _loadManifest() async {
+  Future<Null> _loadManifest() async {
     String json = await bundle.loadString("AssetManifest.json");
     _assetManifest = JSON.decode(json);
   }
diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart
index 509bd9d..c127f28 100644
--- a/packages/flutter/lib/src/widgets/basic.dart
+++ b/packages/flutter/lib/src/widgets/basic.dart
@@ -419,7 +419,7 @@
 
 /// Centers its child within itself.
 class Center extends Align {
-  Center({ Key key, widthFactor, heightFactor, Widget child })
+  Center({ Key key, double widthFactor, double heightFactor, Widget child })
     : super(key: key, widthFactor: widthFactor, heightFactor: heightFactor, child: child);
 }
 
@@ -453,7 +453,7 @@
     Key key,
     Widget child,
     Object id
-  }) : id = id, super(key: key ?? new ValueKey(id), child: child) {
+  }) : id = id, super(key: key ?? new ValueKey<Object>(id), child: child) {
     assert(child != null);
     assert(id != null);
   }
@@ -1388,9 +1388,9 @@
   Row({
     Key key,
     List<Widget> children: _emptyWidgetList,
-    justifyContent: FlexJustifyContent.start,
-    alignItems: FlexAlignItems.center,
-    textBaseline
+    FlexJustifyContent justifyContent: FlexJustifyContent.start,
+    FlexAlignItems alignItems: FlexAlignItems.center,
+    TextBaseline textBaseline
   }) : super(
     children: children,
     key: key,
@@ -1409,9 +1409,9 @@
   Column({
     Key key,
     List<Widget> children: _emptyWidgetList,
-    justifyContent: FlexJustifyContent.start,
-    alignItems: FlexAlignItems.center,
-    textBaseline
+    FlexJustifyContent justifyContent: FlexJustifyContent.start,
+    FlexAlignItems alignItems: FlexAlignItems.center,
+    TextBaseline textBaseline
   }) : super(
     children: children,
     key: key,
diff --git a/packages/flutter/lib/src/widgets/binding.dart b/packages/flutter/lib/src/widgets/binding.dart
index 8873d14..ac0cf19 100644
--- a/packages/flutter/lib/src/widgets/binding.dart
+++ b/packages/flutter/lib/src/widgets/binding.dart
@@ -222,9 +222,11 @@
 class RenderObjectToWidgetElement<T extends RenderObject> extends RenderObjectElement {
   RenderObjectToWidgetElement(RenderObjectToWidgetAdapter<T> widget) : super(widget);
 
+  RenderObjectToWidgetAdapter<T> get widget => super.widget;
+
   Element _child;
 
-  static const _rootChildSlot = const Object();
+  static const Object _rootChildSlot = const Object();
 
   void visitChildren(ElementVisitor visitor) {
     if (_child != null)
diff --git a/packages/flutter/lib/src/widgets/checked_mode_banner.dart b/packages/flutter/lib/src/widgets/checked_mode_banner.dart
index 2aa8af6..5ec239d 100644
--- a/packages/flutter/lib/src/widgets/checked_mode_banner.dart
+++ b/packages/flutter/lib/src/widgets/checked_mode_banner.dart
@@ -10,12 +10,12 @@
 class _CheckedModeBannerPainter extends CustomPainter {
   const _CheckedModeBannerPainter();
 
-  static const kColor = const Color(0xA0B71C1C);
-  static const kOffset = 40.0; // distance to bottom of banner, at a 45 degree angle inwards from the top right corner
-  static const kHeight = 12.0; // height of banner
-  static const kTextAlign = const Offset(0.0, -3.0); // offset to move text up
-  static const kFontSize = kHeight * 0.85;
-  static const kShadowBlur = 4.0; // shadow blur sigma
+  static const Color kColor = const Color(0xA0B71C1C);
+  static const double kOffset = 40.0; // distance to bottom of banner, at a 45 degree angle inwards from the top right corner
+  static const double kHeight = 12.0; // height of banner
+  static const Offset kTextAlign = const Offset(0.0, -3.0); // offset to move text up
+  static const double kFontSize = kHeight * 0.85;
+  static const double kShadowBlur = 4.0; // shadow blur sigma
   static final Rect kRect = new Rect.fromLTWH(-kOffset, kOffset-kHeight, kOffset * 2.0, kHeight);
   static const TextStyle kTextStyles = const TextStyle(
     color: const Color(0xFFFFFFFF),
diff --git a/packages/flutter/lib/src/widgets/drag_target.dart b/packages/flutter/lib/src/widgets/drag_target.dart
index 8f129d0..738fe4b 100644
--- a/packages/flutter/lib/src/widgets/drag_target.dart
+++ b/packages/flutter/lib/src/widgets/drag_target.dart
@@ -80,7 +80,7 @@
 
   /// Should return a new MultiDragGestureRecognizer instance
   /// constructed with the given arguments.
-  MultiDragGestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart);
+  MultiDragGestureRecognizer<dynamic> createRecognizer(GestureMultiDragStartCallback onStart);
 
   _DraggableState<T> createState() => new _DraggableState<T>();
 }
@@ -107,7 +107,7 @@
     maxSimultaneousDrags: maxSimultaneousDrags
   );
 
-  MultiDragGestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart) {
+  ImmediateMultiDragGestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart) {
     return new ImmediateMultiDragGestureRecognizer()..onStart = onStart;
   }
 }
@@ -135,7 +135,7 @@
     maxSimultaneousDrags: maxSimultaneousDrags
   );
 
-  MultiDragGestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart) {
+  HorizontalMultiDragGestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart) {
     return new HorizontalMultiDragGestureRecognizer()..onStart = onStart;
   }
 }
@@ -163,7 +163,7 @@
     maxSimultaneousDrags: maxSimultaneousDrags
   );
 
-  MultiDragGestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart) {
+  VerticalMultiDragGestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart) {
     return new VerticalMultiDragGestureRecognizer()..onStart = onStart;
   }
 }
@@ -190,7 +190,7 @@
     maxSimultaneousDrags: maxSimultaneousDrags
   );
 
-  MultiDragGestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart) {
+  DelayedMultiDragGestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart) {
     return new DelayedMultiDragGestureRecognizer()
       ..onStart = (Point position) {
         Drag result = onStart(position);
@@ -217,7 +217,7 @@
     _recognizer.addPointer(event);
   }
 
-  _DragAvatar _startDrag(Point position) {
+  _DragAvatar<T> _startDrag(Point position) {
     if (config.maxSimultaneousDrags != null && _activeCount >= config.maxSimultaneousDrags)
       return null;
     Point dragStartPoint;
@@ -361,7 +361,7 @@
   final Offset feedbackOffset;
   final VoidCallback onDragEnd;
 
-  _DragTargetState _activeTarget;
+  _DragTargetState<T> _activeTarget;
   bool _activeTargetWillAcceptDrop = false;
   Point _position;
   Offset _lastOffset;
@@ -384,7 +384,7 @@
     _entry.markNeedsBuild();
     HitTestResult result = new HitTestResult();
     WidgetFlutterBinding.instance.hitTest(result, globalPosition + feedbackOffset);
-    _DragTargetState target = _getDragTarget(result.path);
+    _DragTargetState<T> target = _getDragTarget(result.path);
     if (target == _activeTarget)
       return;
     if (_activeTarget != null)
@@ -393,13 +393,13 @@
     _activeTargetWillAcceptDrop = _activeTarget != null && _activeTarget.didEnter(data);
   }
 
-  _DragTargetState _getDragTarget(List<HitTestEntry> path) {
+  _DragTargetState<T> _getDragTarget(List<HitTestEntry> path) {
     // Look for the RenderBox that corresponds to the hit target (the hit target
     // widget builds a RenderMetadata box for us for this purpose).
     for (HitTestEntry entry in path) {
       if (entry.target is RenderMetaData) {
         RenderMetaData renderMetaData = entry.target;
-        if (renderMetaData.metaData is _DragTargetState)
+        if (renderMetaData.metaData is _DragTargetState<T>)
           return renderMetaData.metaData;
       }
     }
diff --git a/packages/flutter/lib/src/widgets/editable.dart b/packages/flutter/lib/src/widgets/editable.dart
index 8e833a3..e722cfa 100644
--- a/packages/flutter/lib/src/widgets/editable.dart
+++ b/packages/flutter/lib/src/widgets/editable.dart
@@ -192,7 +192,7 @@
   _KeyboardClientImpl _keyboardClient;
   KeyboardHandle _keyboardHandle;
 
-  ScrollBehavior createScrollBehavior() => new BoundedBehavior();
+  ScrollBehavior<double, double> createScrollBehavior() => new BoundedBehavior();
   BoundedBehavior get scrollBehavior => super.scrollBehavior;
 
   void initState() {
diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart
index 8bf1794..70256d7 100644
--- a/packages/flutter/lib/src/widgets/framework.dart
+++ b/packages/flutter/lib/src/widgets/framework.dart
@@ -119,8 +119,8 @@
   Widget get currentWidget => _currentElement?.widget;
   T get currentState {
     Element element = _currentElement;
-    if (element is StatefulComponentElement<StatefulComponent, T>) {
-      StatefulComponentElement<StatefulComponent, T> statefulElement = element;
+    if (element is StatefulComponentElement) {
+      StatefulComponentElement statefulElement = element;
       return statefulElement.state;
     }
     return null;
@@ -304,7 +304,7 @@
 
   /// Verifies that the State that was created is one that expects to be created
   /// for that particular Widget.
-  bool _debugTypesAreRight(widget) => widget is T;
+  bool _debugTypesAreRight(Widget widget) => widget is T;
 
   /// Pointer to the owner Element object
   StatefulComponentElement _element;
@@ -420,7 +420,7 @@
   const ParentDataWidget({ Key key, Widget child })
     : super(key: key, child: child);
 
-  ParentDataElement createElement() => new ParentDataElement(this);
+  ParentDataElement<T> createElement() => new ParentDataElement<T>(this);
 
   /// Subclasses should override this function to return true if the given
   /// ancestor is a RenderObjectWidget that wraps a RenderObject that can handle
@@ -612,8 +612,8 @@
 ///
 /// Elements can, in principle, have children. Only subclasses of
 /// RenderObjectElement are allowed to have more than one child.
-abstract class Element<T extends Widget> implements BuildContext {
-  Element(T widget) : _widget = widget {
+abstract class Element implements BuildContext {
+  Element(Widget widget) : _widget = widget {
     assert(widget != null);
   }
 
@@ -633,8 +633,8 @@
   int _depth;
 
   /// The configuration for this element.
-  T get widget => _widget;
-  T _widget;
+  Widget get widget => _widget;
+  Widget _widget;
 
   bool _active = false;
 
@@ -744,7 +744,7 @@
   }
 
   /// Called when an Element receives a new configuration widget.
-  void update(T newWidget) {
+  void update(Widget newWidget) {
     assert(_debugLifecycleState == _ElementLifecycle.active);
     assert(widget != null);
     assert(newWidget != null);
@@ -1040,8 +1040,8 @@
 
 /// Base class for instantiations of widgets that have builders and can be
 /// marked dirty.
-abstract class BuildableElement<T extends Widget> extends Element<T> {
-  BuildableElement(T widget) : super(widget);
+abstract class BuildableElement extends Element {
+  BuildableElement(Widget widget) : super(widget);
 
   /// Returns true if the element has been marked as needing rebuilding.
   bool get dirty => _dirty;
@@ -1197,8 +1197,8 @@
 
 /// Base class for the instantiation of StatelessComponent, StatefulComponent,
 /// and ProxyComponent widgets.
-abstract class ComponentElement<T extends Widget> extends BuildableElement<T> {
-  ComponentElement(T widget) : super(widget);
+abstract class ComponentElement extends BuildableElement {
+  ComponentElement(Widget widget) : super(widget);
 
   WidgetBuilder _builder;
   Element _child;
@@ -1271,12 +1271,14 @@
 }
 
 /// Instantiation of StatelessComponent widgets.
-class StatelessComponentElement<T extends StatelessComponent> extends ComponentElement<T> {
-  StatelessComponentElement(T widget) : super(widget) {
+class StatelessComponentElement extends ComponentElement {
+  StatelessComponentElement(StatelessComponent widget) : super(widget) {
     _builder = widget.build;
   }
 
-  void update(T newWidget) {
+  StatelessComponent get widget => super.widget;
+
+  void update(StatelessComponent newWidget) {
     super.update(newWidget);
     assert(widget == newWidget);
     _builder = widget.build;
@@ -1286,10 +1288,10 @@
 }
 
 /// Instantiation of StatefulComponent widgets.
-class StatefulComponentElement<T extends StatefulComponent, U extends State<T>> extends ComponentElement<T> {
-  StatefulComponentElement(T widget)
+class StatefulComponentElement extends ComponentElement {
+  StatefulComponentElement(StatefulComponent widget)
     : _state = widget.createState(), super(widget) {
-    assert(_state._debugTypesAreRight(widget)); // can't use T and U, since normally we don't actually set those
+    assert(_state._debugTypesAreRight(widget));
     assert(_state._element == null);
     _state._element = this;
     assert(_builder == null);
@@ -1299,8 +1301,8 @@
     assert(_state._debugLifecycleState == _StateLifecycle.created);
   }
 
-  U get state => _state;
-  U _state;
+  State<StatefulComponent> get state => _state;
+  State<StatefulComponent> _state;
 
   void _firstBuild() {
     assert(_state._debugLifecycleState == _StateLifecycle.created);
@@ -1323,7 +1325,7 @@
     super._firstBuild();
   }
 
-  void update(T newWidget) {
+  void update(StatefulComponent newWidget) {
     super.update(newWidget);
     assert(widget == newWidget);
     StatefulComponent oldConfig = _state._config;
@@ -1375,15 +1377,17 @@
   }
 }
 
-abstract class _ProxyElement<T extends _ProxyComponent> extends ComponentElement<T> {
-  _ProxyElement(T widget) : super(widget) {
+abstract class _ProxyElement extends ComponentElement {
+  _ProxyElement(_ProxyComponent widget) : super(widget) {
     _builder = _build;
   }
 
+  _ProxyComponent get widget => super.widget;
+
   Widget _build(BuildContext context) => widget.child;
 
-  void update(T newWidget) {
-    T oldWidget = widget;
+  void update(_ProxyComponent newWidget) {
+    _ProxyComponent oldWidget = widget;
     assert(widget != null);
     assert(widget != newWidget);
     super.update(newWidget);
@@ -1393,18 +1397,20 @@
     rebuild();
   }
 
-  void notifyDescendants(T oldWidget);
+  void notifyDescendants(_ProxyComponent oldWidget);
 }
 
-class ParentDataElement extends _ProxyElement<ParentDataWidget> {
-  ParentDataElement(ParentDataWidget widget) : super(widget);
+class ParentDataElement<T extends RenderObjectWidget> extends _ProxyElement {
+  ParentDataElement(ParentDataWidget<T> widget) : super(widget);
+
+  ParentDataWidget<T> get widget => super.widget;
 
   void mount(Element parent, dynamic slot) {
     assert(() {
       List<Widget> badAncestors = <Widget>[];
       Element ancestor = parent;
       while (ancestor != null) {
-        if (ancestor is ParentDataElement) {
+        if (ancestor is ParentDataElement<dynamic>) {
           badAncestors.add(ancestor.widget);
         } else if (ancestor is RenderObjectElement) {
           if (widget.debugIsValidAncestor(ancestor.widget))
@@ -1428,12 +1434,14 @@
     super.mount(parent, slot);
   }
 
-  void notifyDescendants(ParentDataWidget oldWidget) {
+  void notifyDescendants(ParentDataWidget<T> oldWidget) {
     void notifyChildren(Element child) {
-      if (child is RenderObjectElement)
+      if (child is RenderObjectElement) {
         child.updateParentData(widget);
-      else if (child is! ParentDataElement)
+      } else {
+        assert(child is! ParentDataElement<dynamic>);
         child.visitChildren(notifyChildren);
+      }
     }
     visitChildren(notifyChildren);
   }
@@ -1441,9 +1449,11 @@
 
 
 
-class InheritedElement extends _ProxyElement<InheritedWidget> {
+class InheritedElement extends _ProxyElement {
   InheritedElement(InheritedWidget widget) : super(widget);
 
+  InheritedWidget get widget => super.widget;
+
   final Set<Element> _dependants = new HashSet<Element>();
 
   void _updateInheritance() {
@@ -1481,8 +1491,10 @@
 }
 
 /// Base class for instantiations of RenderObjectWidget subclasses
-abstract class RenderObjectElement<T extends RenderObjectWidget> extends BuildableElement<T> {
-  RenderObjectElement(T widget) : super(widget);
+abstract class RenderObjectElement extends BuildableElement {
+  RenderObjectElement(RenderObjectWidget widget) : super(widget);
+
+  RenderObjectWidget get widget => super.widget;
 
   /// The underlying [RenderObject] for this element
   RenderObject get renderObject => _renderObject;
@@ -1497,10 +1509,10 @@
     return ancestor;
   }
 
-  ParentDataElement _findAncestorParentDataElement() {
+  ParentDataElement<dynamic> _findAncestorParentDataElement() {
     Element ancestor = _parent;
     while (ancestor != null && ancestor is! RenderObjectElement) {
-      if (ancestor is ParentDataElement)
+      if (ancestor is ParentDataElement<dynamic>)
         return ancestor;
       ancestor = ancestor._parent;
     }
@@ -1516,7 +1528,7 @@
     _dirty = false;
   }
 
-  void update(T newWidget) {
+  void update(RenderObjectWidget newWidget) {
     super.update(newWidget);
     assert(widget == newWidget);
     assert(() { debugUpdateRenderObjectOwner(); return true; });
@@ -1702,7 +1714,7 @@
     widget.didUnmountRenderObject(renderObject);
   }
 
-  void updateParentData(ParentDataWidget parentData) {
+  void updateParentData(ParentDataWidget<dynamic> parentData) {
     parentData.applyParentData(renderObject);
   }
 
@@ -1718,7 +1730,7 @@
     _slot = newSlot;
     _ancestorRenderObjectElement = _findAncestorRenderObjectElement();
     _ancestorRenderObjectElement?.insertChildRenderObject(renderObject, newSlot);
-    ParentDataElement parentDataElement = _findAncestorParentDataElement();
+    ParentDataElement<dynamic> parentDataElement = _findAncestorParentDataElement();
     if (parentDataElement != null)
       updateParentData(parentDataElement.widget);
   }
@@ -1743,8 +1755,8 @@
 }
 
 /// Instantiation of RenderObjectWidgets that have no children
-class LeafRenderObjectElement<T extends RenderObjectWidget> extends RenderObjectElement<T> {
-  LeafRenderObjectElement(T widget): super(widget);
+class LeafRenderObjectElement extends RenderObjectElement {
+  LeafRenderObjectElement(LeafRenderObjectWidget widget): super(widget);
 
   void insertChildRenderObject(RenderObject child, dynamic slot) {
     assert(false);
@@ -1760,8 +1772,10 @@
 }
 
 /// Instantiation of RenderObjectWidgets that have up to one child
-class OneChildRenderObjectElement<T extends OneChildRenderObjectWidget> extends RenderObjectElement<T> {
-  OneChildRenderObjectElement(T widget) : super(widget);
+class OneChildRenderObjectElement extends RenderObjectElement {
+  OneChildRenderObjectElement(OneChildRenderObjectWidget widget) : super(widget);
+
+  OneChildRenderObjectWidget get widget => super.widget;
 
   Element _child;
 
@@ -1782,14 +1796,14 @@
     _child = updateChild(_child, widget.child, null);
   }
 
-  void update(T newWidget) {
+  void update(OneChildRenderObjectWidget newWidget) {
     super.update(newWidget);
     assert(widget == newWidget);
     _child = updateChild(_child, widget.child, null);
   }
 
   void insertChildRenderObject(RenderObject child, dynamic slot) {
-    final RenderObjectWithChildMixin renderObject = this.renderObject;
+    final RenderObjectWithChildMixin<dynamic> renderObject = this.renderObject;
     assert(slot == null);
     renderObject.child = child;
     assert(renderObject == this.renderObject);
@@ -1800,7 +1814,7 @@
   }
 
   void removeChildRenderObject(RenderObject child) {
-    final RenderObjectWithChildMixin renderObject = this.renderObject;
+    final RenderObjectWithChildMixin<dynamic> renderObject = this.renderObject;
     assert(renderObject.child == child);
     renderObject.child = null;
     assert(renderObject == this.renderObject);
@@ -1808,37 +1822,39 @@
 }
 
 /// Instantiation of RenderObjectWidgets that can have a list of children
-class MultiChildRenderObjectElement<T extends MultiChildRenderObjectWidget> extends RenderObjectElement<T> {
-  MultiChildRenderObjectElement(T widget) : super(widget) {
+class MultiChildRenderObjectElement extends RenderObjectElement {
+  MultiChildRenderObjectElement(MultiChildRenderObjectWidget widget) : super(widget) {
     assert(!_debugHasDuplicateIds());
   }
 
+  MultiChildRenderObjectWidget get widget => super.widget;
+
   List<Element> _children;
   // We keep a set of detached children to avoid O(n^2) work walking _children
   // repeatedly to remove children.
   final Set<Element> _detachedChildren = new HashSet<Element>();
 
   void insertChildRenderObject(RenderObject child, Element slot) {
-    final ContainerRenderObjectMixin renderObject = this.renderObject;
+    final ContainerRenderObjectMixin<dynamic, dynamic> renderObject = this.renderObject;
     renderObject.insert(child, after: slot?.renderObject);
     assert(renderObject == this.renderObject);
   }
 
   void moveChildRenderObject(RenderObject child, dynamic slot) {
-    final ContainerRenderObjectMixin renderObject = this.renderObject;
+    final ContainerRenderObjectMixin<dynamic, dynamic> renderObject = this.renderObject;
     renderObject.move(child, after: slot?.renderObject);
     assert(renderObject == this.renderObject);
   }
 
   void removeChildRenderObject(RenderObject child) {
-    final ContainerRenderObjectMixin renderObject = this.renderObject;
+    final ContainerRenderObjectMixin<dynamic, dynamic> renderObject = this.renderObject;
     assert(child.parent == renderObject);
     renderObject.remove(child);
     assert(renderObject == this.renderObject);
   }
 
   bool _debugHasDuplicateIds() {
-    var idSet = new HashSet<Key>();
+    Set<Key> idSet = new HashSet<Key>();
     for (Widget child in widget.children) {
       assert(child != null);
       if (child.key == null)
@@ -1879,7 +1895,7 @@
     }
   }
 
-  void update(T newWidget) {
+  void update(MultiChildRenderObjectWidget newWidget) {
     super.update(newWidget);
     assert(widget == newWidget);
     _children = updateChildren(_children, widget.children, detachedChildren: _detachedChildren);
diff --git a/packages/flutter/lib/src/widgets/heroes.dart b/packages/flutter/lib/src/widgets/heroes.dart
index 69ffc8b..1f06e98 100644
--- a/packages/flutter/lib/src/widgets/heroes.dart
+++ b/packages/flutter/lib/src/widgets/heroes.dart
@@ -104,10 +104,11 @@
     Map<Object, Map<Key, HeroState>> heroes = <Object, Map<Key, HeroState>>{};
     void visitor(Element element) {
       if (element.widget is Hero) {
-        StatefulComponentElement<Hero, HeroState> hero = element;
-        Object tag = hero.widget.tag;
+        StatefulComponentElement hero = element;
+        Hero heroWidget = element.widget;
+        Object tag = heroWidget.tag;
         assert(tag != null);
-        Key key = hero.widget.key;
+        Key key = heroWidget.key;
         final Map<Key, HeroState> tagHeroes = heroes.putIfAbsent(tag, () => <Key, HeroState>{});
         assert(() {
           if (tagHeroes.containsKey(key)) {
@@ -395,17 +396,17 @@
 
   HeroParty _party;
   Animation<double> _animation;
-  PageRoute _from;
-  PageRoute _to;
+  PageRoute<dynamic> _from;
+  PageRoute<dynamic> _to;
 
   final List<OverlayEntry> _overlayEntries = new List<OverlayEntry>();
 
-  void didPush(Route route, Route previousRoute) {
+  void didPush(Route<dynamic> route, Route<dynamic> previousRoute) {
     assert(navigator != null);
     assert(route != null);
-    if (route is PageRoute) {
+    if (route is PageRoute<dynamic>) {
       assert(route.animation != null);
-      if (previousRoute is PageRoute) // could be null
+      if (previousRoute is PageRoute<dynamic>) // could be null
         _from = previousRoute;
       _to = route;
       _animation = route.animation;
@@ -413,12 +414,12 @@
     }
   }
 
-  void didPop(Route route, Route previousRoute) {
+  void didPop(Route<dynamic> route, Route<dynamic> previousRoute) {
     assert(navigator != null);
     assert(route != null);
-    if (route is PageRoute) {
+    if (route is PageRoute<dynamic>) {
       assert(route.animation != null);
-      if (previousRoute is PageRoute) {
+      if (previousRoute is PageRoute<dynamic>) {
         _to = previousRoute;
         _from = route;
         _animation = route.animation;
diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart
index fb72162..dca532d 100644
--- a/packages/flutter/lib/src/widgets/implicit_animations.dart
+++ b/packages/flutter/lib/src/widgets/implicit_animations.dart
@@ -68,7 +68,7 @@
   /// The duration over which to animate the parameters of this container.
   final Duration duration;
 
-  AnimatedWidgetBaseState createState();
+  AnimatedWidgetBaseState<AnimatedWidgetBase> createState();
 
   void debugFillDescription(List<String> description) {
     super.debugFillDescription(description);
@@ -105,7 +105,7 @@
       _updateCurve();
     _controller.duration = config.duration;
     if (_constructTweens()) {
-      forEachTween((Tween tween, dynamic targetValue, TweenConstructor<T> constructor) {
+      forEachTween((Tween<dynamic> tween, dynamic targetValue, TweenConstructor<dynamic> constructor) {
         _updateTween(tween, targetValue);
         return tween;
       });
@@ -131,11 +131,11 @@
     setState(() { });
   }
 
-  bool _shouldAnimateTween(Tween tween, dynamic targetValue) {
+  bool _shouldAnimateTween(Tween<dynamic> tween, dynamic targetValue) {
     return targetValue != (tween.end ?? tween.begin);
   }
 
-  void _updateTween(Tween tween, dynamic targetValue) {
+  void _updateTween(Tween<dynamic> tween, dynamic targetValue) {
     if (tween == null)
       return;
     tween
@@ -145,7 +145,7 @@
 
   bool _constructTweens() {
     bool shouldStartAnimation = false;
-    forEachTween((Tween tween, dynamic targetValue, TweenConstructor<T> constructor) {
+    forEachTween((Tween<dynamic> tween, dynamic targetValue, TweenConstructor<T> constructor) {
       if (targetValue != null) {
         tween ??= constructor(targetValue);
         if (_shouldAnimateTween(tween, targetValue))
@@ -173,7 +173,7 @@
   /// 2. Take the value returned from the callback, and store it. This is the
   /// value to use as the current value the next time that the forEachTween()
   /// method is called.
-  void forEachTween(TweenVisitor visitor);
+  void forEachTween(TweenVisitor<dynamic> visitor);
 }
 
 /// A container that gradually changes its values over a period of time.
@@ -262,7 +262,7 @@
   Tween<double> _width;
   Tween<double> _height;
 
-  void forEachTween(TweenVisitor visitor) {
+  void forEachTween(TweenVisitor<dynamic> visitor) {
     // TODO(ianh): Use constructor tear-offs when it becomes possible
     _constraints = visitor(_constraints, config.constraints, (dynamic value) => new BoxConstraintsTween(begin: value));
     _decoration = visitor(_decoration, config.decoration, (dynamic value) => new DecorationTween(begin: value));
@@ -381,7 +381,7 @@
   Tween<double> _width;
   Tween<double> _height;
 
-  void forEachTween(TweenVisitor visitor) {
+  void forEachTween(TweenVisitor<dynamic> visitor) {
     // TODO(ianh): Use constructor tear-offs when it becomes possible
     _left = visitor(_left, config.left, (dynamic value) => new Tween<double>(begin: value));
     _top = visitor(_top, config.top, (dynamic value) => new Tween<double>(begin: value));
diff --git a/packages/flutter/lib/src/widgets/locale_query.dart b/packages/flutter/lib/src/widgets/locale_query.dart
index 5e34e68..b45f0b5 100644
--- a/packages/flutter/lib/src/widgets/locale_query.dart
+++ b/packages/flutter/lib/src/widgets/locale_query.dart
@@ -5,10 +5,10 @@
 import 'framework.dart';
 
 /// Superclass for locale-specific data provided by the application.
-class LocaleQueryData { }
+class LocaleQueryData { } // TODO(ianh): We need a better type here. This doesn't really make sense.
 
 /// Establishes a subtree in which locale queries resolve to the given data.
-class LocaleQuery<T extends LocaleQueryData> extends InheritedWidget {
+class LocaleQuery extends InheritedWidget {
   LocaleQuery({
     Key key,
     this.data,
@@ -18,7 +18,7 @@
   }
 
   /// The locale data for this subtree.
-  final T data;
+  final LocaleQueryData data;
 
   /// The data from the closest instance of this class that encloses the given context.
   static LocaleQueryData of(BuildContext context) {
diff --git a/packages/flutter/lib/src/widgets/mimic.dart b/packages/flutter/lib/src/widgets/mimic.dart
index 38fb204..5c00f13 100644
--- a/packages/flutter/lib/src/widgets/mimic.dart
+++ b/packages/flutter/lib/src/widgets/mimic.dart
@@ -48,7 +48,7 @@
   /// given curve.
   ///
   /// This function can only be called once per overlay entry.
-  Future animateTo({
+  Future<Null> animateTo({
     GlobalKey targetKey,
     Duration duration,
     Curve curve: Curves.linear
diff --git a/packages/flutter/lib/src/widgets/mixed_viewport.dart b/packages/flutter/lib/src/widgets/mixed_viewport.dart
index 6ba504a..9ae013f 100644
--- a/packages/flutter/lib/src/widgets/mixed_viewport.dart
+++ b/packages/flutter/lib/src/widgets/mixed_viewport.dart
@@ -68,12 +68,14 @@
   String toString() => "_ChildKey(type: $type, key: $key)";
 }
 
-class _MixedViewportElement extends RenderObjectElement<MixedViewport> {
+class _MixedViewportElement extends RenderObjectElement {
   _MixedViewportElement(MixedViewport widget) : super(widget) {
     if (widget.onInvalidatorAvailable != null)
       widget.onInvalidatorAvailable(invalidate);
   }
 
+  MixedViewport get widget => super.widget;
+
   /// _childExtents contains the extents of each child from the top of the list
   /// up to the last one we've ever created.
   final List<double> _childExtents = <double>[];
diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart
index a394126..ea06393 100644
--- a/packages/flutter/lib/src/widgets/navigator.dart
+++ b/packages/flutter/lib/src/widgets/navigator.dart
@@ -33,7 +33,7 @@
   void didPush() { }
 
   /// Called after install() when the route replaced another in the navigator.
-  void didReplace(Route oldRoute) { }
+  void didReplace(Route<dynamic> oldRoute) { }
 
   /// A request was made to pop this route. If the route can handle it
   /// internally (e.g. because it has its own stack of internal state) then
@@ -49,13 +49,13 @@
 
   /// The given route, which came after this one, has been popped off the
   /// navigator.
-  void didPopNext(Route nextRoute) { }
+  void didPopNext(Route<dynamic> nextRoute) { }
 
   /// This route's next route has changed to the given new route. This is called
   /// on a route whenever the next route changes for any reason, except for
   /// cases when didPopNext() would be called, so long as it is in the history.
   /// nextRoute will be null if there's no next route.
-  void didChangeNext(Route nextRoute) { }
+  void didChangeNext(Route<dynamic> nextRoute) { }
 
   /// The route should remove its overlays and free any other resources.
   ///
@@ -109,7 +109,7 @@
 }
 
 /// Creates a route for the given route settings.
-typedef Route RouteFactory(RouteSettings settings);
+typedef Route<dynamic> RouteFactory(RouteSettings settings);
 
 /// A callback in during which you can perform a number of navigator operations (e.g., pop, push) that happen atomically.
 typedef void NavigatorTransactionCallback(NavigatorTransaction transaction);
@@ -121,10 +121,10 @@
   NavigatorState _navigator;
 
   /// The [Navigator] pushed the given route.
-  void didPush(Route route, Route previousRoute) { }
+  void didPush(Route<dynamic> route, Route<dynamic> previousRoute) { }
 
   /// THe [Navigator] popped the given route.
-  void didPop(Route route, Route previousRoute) { }
+  void didPop(Route<dynamic> route, Route<dynamic> previousRoute) { }
 }
 
 /// Manages a set of child widgets with a stack discipline.
@@ -189,7 +189,7 @@
   /// Navigator observer, if any, will have didPush() called on it.
   ///
   /// Uses [openTransaction()]. Only one transaction will be executed per frame.
-  static void push(BuildContext context, Route route) {
+  static void push(BuildContext context, Route<dynamic> route) {
     openTransaction(context, (NavigatorTransaction transaction) {
       transaction.push(route);
     });
@@ -224,7 +224,7 @@
   /// If it is already the current route, nothing happens.
   ///
   /// Uses [openTransaction()]. Only one transaction will be executed per frame.
-  static void popUntil(BuildContext context, Route targetRoute) {
+  static void popUntil(BuildContext context, Route<dynamic> targetRoute) {
     openTransaction(context, (NavigatorTransaction transaction) {
       transaction.popUntil(targetRoute);
     });
@@ -277,7 +277,7 @@
 /// The state for a [Navigator] widget.
 class NavigatorState extends State<Navigator> {
   final GlobalKey<OverlayState> _overlayKey = new GlobalKey<OverlayState>();
-  final List<Route> _history = new List<Route>();
+  final List<Route<dynamic>> _history = new List<Route<dynamic>>();
 
   void initState() {
     super.initState();
@@ -301,7 +301,7 @@
     assert(!_debugLocked);
     assert(() { _debugLocked = true; return true; });
     config.observer?._navigator = null;
-    for (Route route in _history) {
+    for (Route<dynamic> route in _history) {
       route.dispose();
       route._navigator = null;
     }
@@ -313,7 +313,7 @@
   OverlayState get overlay => _overlayKey.currentState;
 
   OverlayEntry get _currentOverlayEntry {
-    for (Route route in _history.reversed) {
+    for (Route<dynamic> route in _history.reversed) {
       if (route.overlayEntries.isNotEmpty)
         return route.overlayEntries.last;
     }
@@ -329,7 +329,7 @@
       name: name,
       mostValuableKeys: mostValuableKeys
     );
-    Route route = config.onGenerateRoute(settings);
+    Route<dynamic> route = config.onGenerateRoute(settings);
     if (route == null) {
       assert(config.onUnknownRoute != null);
       route = config.onUnknownRoute(settings);
@@ -338,13 +338,13 @@
     _push(route);
   }
 
-  void _push(Route route) {
+  void _push(Route<dynamic> route) {
     assert(!_debugLocked);
     assert(() { _debugLocked = true; return true; });
     assert(route != null);
     assert(route._navigator == null);
     setState(() {
-      Route oldRoute = _history.isNotEmpty ? _history.last : null;
+      Route<dynamic> oldRoute = _history.isNotEmpty ? _history.last : null;
       route._navigator = this;
       route.install(_currentOverlayEntry);
       _history.add(route);
@@ -357,7 +357,7 @@
     assert(() { _debugLocked = false; return true; });
   }
 
-  void _replace({ Route oldRoute, Route newRoute }) {
+  void _replace({ Route<dynamic> oldRoute, Route<dynamic> newRoute }) {
     assert(!_debugLocked);
     assert(oldRoute != null);
     assert(newRoute != null);
@@ -388,25 +388,25 @@
     assert(() { _debugLocked = false; return true; });
   }
 
-  void _replaceRouteBefore({ Route anchorRoute, Route newRoute }) {
+  void _replaceRouteBefore({ Route<dynamic> anchorRoute, Route<dynamic> newRoute }) {
     assert(anchorRoute != null);
     assert(anchorRoute._navigator == this);
     assert(_history.indexOf(anchorRoute) > 0);
     _replace(oldRoute: _history[_history.indexOf(anchorRoute)-1], newRoute: newRoute);
   }
 
-  void _removeRouteBefore(Route anchorRoute) {
+  void _removeRouteBefore(Route<dynamic> anchorRoute) {
     assert(!_debugLocked);
     assert(() { _debugLocked = true; return true; });
     assert(anchorRoute._navigator == this);
     int index = _history.indexOf(anchorRoute) - 1;
     assert(index >= 0);
-    Route targetRoute = _history[index];
+    Route<dynamic> targetRoute = _history[index];
     assert(targetRoute._navigator == this);
     assert(targetRoute.overlayEntries.isEmpty || !overlay.debugIsVisible(targetRoute.overlayEntries.last));
     setState(() {
       _history.removeAt(index);
-      Route newRoute = index < _history.length ? _history[index] : null;
+      Route<dynamic> newRoute = index < _history.length ? _history[index] : null;
       if (index > 0)
         _history[index - 1].didChangeNext(newRoute);
       targetRoute.dispose();
@@ -418,7 +418,7 @@
   bool _pop([dynamic result]) {
     assert(!_debugLocked);
     assert(() { _debugLocked = true; return true; });
-    Route route = _history.last;
+    Route<dynamic> route = _history.last;
     assert(route._navigator == this);
     bool debugPredictedWouldPop;
     assert(() { debugPredictedWouldPop = !route.willHandlePopInternally; return true; });
@@ -445,7 +445,7 @@
     return true;
   }
 
-  void _popUntil(Route targetRoute) {
+  void _popUntil(Route<dynamic> targetRoute) {
     assert(_history.contains(targetRoute));
     while (!targetRoute.isCurrent)
       _pop();
@@ -512,7 +512,7 @@
   /// The route will have didPush() and didChangeNext() called on it; the
   /// previous route, if any, will have didChangeNext() called on it; and the
   /// Navigator observer, if any, will have didPush() called on it.
-  void push(Route route) {
+  void push(Route<dynamic> route) {
     assert(_debugOpen);
     _navigator._push(route);
   }
@@ -528,7 +528,7 @@
   ///
   /// It is safe to call this redundantly (replacing a route with itself). Such
   /// calls are ignored.
-  void replace({ Route oldRoute, Route newRoute }) {
+  void replace({ Route<dynamic> oldRoute, Route<dynamic> newRoute }) {
     assert(_debugOpen);
     _navigator._replace(oldRoute: oldRoute, newRoute: newRoute);
   }
@@ -541,14 +541,14 @@
   ///
   /// The conditions described for [replace()] apply; for instance, the route
   /// before anchorRoute must have overlay entries.
-  void replaceRouteBefore({ Route anchorRoute, Route newRoute }) {
+  void replaceRouteBefore({ Route<dynamic> anchorRoute, Route<dynamic> newRoute }) {
     assert(_debugOpen);
     _navigator._replaceRouteBefore(anchorRoute: anchorRoute, newRoute: newRoute);
   }
 
   /// Removes the route prior to the given anchorRoute, and calls didChangeNext
   /// on the route prior to that one, if any. The observer is not notified.
-  void removeRouteBefore(Route anchorRoute) {
+  void removeRouteBefore(Route<dynamic> anchorRoute) {
     assert(_debugOpen);
     _navigator._removeRouteBefore(anchorRoute);
   }
@@ -573,7 +573,7 @@
 
   /// Calls pop() repeatedly until the given route is the current route.
   /// If it is already the current route, nothing happens.
-  void popUntil(Route targetRoute) {
+  void popUntil(Route<dynamic> targetRoute) {
     assert(_debugOpen);
     _navigator._popUntil(targetRoute);
   }
diff --git a/packages/flutter/lib/src/widgets/notification_listener.dart b/packages/flutter/lib/src/widgets/notification_listener.dart
index 021a4e3..9f2a83f 100644
--- a/packages/flutter/lib/src/widgets/notification_listener.dart
+++ b/packages/flutter/lib/src/widgets/notification_listener.dart
@@ -13,9 +13,9 @@
   void dispatch(BuildContext target) {
     target.visitAncestorElements((Element element) {
       if (element is StatelessComponentElement &&
-          element.widget is NotificationListener) {
-        final NotificationListener widget = element.widget;
-        if (widget._dispatch(this))
+          element.widget is NotificationListener<dynamic>) {
+        final NotificationListener<dynamic> widget = element.widget;
+        if (widget._dispatch(this)) // that function checks the type dynamically
           return false;
       }
       return true;
diff --git a/packages/flutter/lib/src/widgets/pageable_list.dart b/packages/flutter/lib/src/widgets/pageable_list.dart
index 987c8e2..a740e80 100644
--- a/packages/flutter/lib/src/widgets/pageable_list.dart
+++ b/packages/flutter/lib/src/widgets/pageable_list.dart
@@ -71,7 +71,7 @@
   /// The list of pages themselves.
   final Iterable<Widget> children;
 
-  PageableListState createState() => new PageableListState();
+  PageableListState<PageableList> createState() => new PageableListState<PageableList>();
 }
 
 /// State for a [PageableList] widget.
@@ -185,7 +185,7 @@
     return _overscrollBehavior;
   }
 
-  ScrollBehavior createScrollBehavior() => scrollBehavior;
+  ScrollBehavior<double, double> createScrollBehavior() => scrollBehavior;
 
   bool get shouldSnapScrollOffset => config.itemsSnapAlignment == ItemsSnapAlignment.item;
 
@@ -196,14 +196,14 @@
       .clamp(scrollBehavior.minScrollOffset, scrollBehavior.maxScrollOffset);
   }
 
-  Future _flingToAdjacentItem(double scrollVelocity) {
+  Future<Null> _flingToAdjacentItem(double scrollVelocity) {
     final double newScrollOffset = snapScrollOffset(scrollOffset + scrollVelocity.sign)
       .clamp(snapScrollOffset(scrollOffset - 0.5), snapScrollOffset(scrollOffset + 0.5));
     return scrollTo(newScrollOffset, duration: config.duration, curve: config.curve)
       .then(_notifyPageChanged);
   }
 
-  Future fling(double scrollVelocity) {
+  Future<Null> fling(double scrollVelocity) {
     switch(config.itemsSnapAlignment) {
       case ItemsSnapAlignment.adjacentItem:
         return _flingToAdjacentItem(scrollVelocity);
@@ -212,7 +212,7 @@
     }
   }
 
-  Future settleScrollOffset() {
+  Future<Null> settleScrollOffset() {
     return scrollTo(snapScrollOffset(scrollOffset), duration: config.duration, curve: config.curve)
       .then(_notifyPageChanged);
   }
@@ -247,9 +247,11 @@
   _PageViewportElement createElement() => new _PageViewportElement(this);
 }
 
-class _PageViewportElement extends VirtualViewportElement<PageViewport> {
+class _PageViewportElement extends VirtualViewportElement {
   _PageViewportElement(PageViewport widget) : super(widget);
 
+  PageViewport get widget => super.widget;
+
   RenderList get renderObject => super.renderObject;
 
   int get materializedChildBase => _materializedChildBase;
diff --git a/packages/flutter/lib/src/widgets/pages.dart b/packages/flutter/lib/src/widgets/pages.dart
index edbe3bc..f0abba4 100644
--- a/packages/flutter/lib/src/widgets/pages.dart
+++ b/packages/flutter/lib/src/widgets/pages.dart
@@ -17,8 +17,8 @@
   }) : super(completer: completer, settings: settings);
   bool get opaque => true;
   bool get barrierDismissable => false;
-  bool canTransitionTo(TransitionRoute nextRoute) => nextRoute is PageRoute;
-  bool canTransitionFrom(TransitionRoute nextRoute) => nextRoute is PageRoute;
+  bool canTransitionTo(TransitionRoute<dynamic> nextRoute) => nextRoute is PageRoute<dynamic>;
+  bool canTransitionFrom(TransitionRoute<dynamic> nextRoute) => nextRoute is PageRoute<dynamic>;
 
   AnimationController createAnimationController() {
     AnimationController controller = super.createAnimationController();
diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart
index e412fa0..4e4a8ac 100644
--- a/packages/flutter/lib/src/widgets/routes.dart
+++ b/packages/flutter/lib/src/widgets/routes.dart
@@ -13,7 +13,7 @@
 import 'page_storage.dart';
 import 'pages.dart';
 
-const _kTransparent = const Color(0x00000000);
+const Color _kTransparent = const Color(0x00000000);
 
 /// A route that displays widgets in the [Navigator]'s [Overlay].
 abstract class OverlayRoute<T> extends Route<T> {
@@ -159,8 +159,8 @@
     super.didPush();
   }
 
-  void didReplace(Route oldRoute) {
-    if (oldRoute is TransitionRoute)
+  void didReplace(Route<dynamic> oldRoute) {
+    if (oldRoute is TransitionRoute<dynamic>)
       _controller.value = oldRoute._controller.value;
     _animation.addStatusListener(_handleStatusChanged);
     super.didReplace(oldRoute);
@@ -173,18 +173,18 @@
     return true;
   }
 
-  void didPopNext(Route nextRoute) {
+  void didPopNext(Route<dynamic> nextRoute) {
     _updateForwardAnimation(nextRoute);
     super.didPopNext(nextRoute);
   }
 
-  void didChangeNext(Route nextRoute) {
+  void didChangeNext(Route<dynamic> nextRoute) {
     _updateForwardAnimation(nextRoute);
     super.didChangeNext(nextRoute);
   }
 
-  void _updateForwardAnimation(Route nextRoute) {
-    if (nextRoute is TransitionRoute && canTransitionTo(nextRoute) && nextRoute.canTransitionFrom(this)) {
+  void _updateForwardAnimation(Route<dynamic> nextRoute) {
+    if (nextRoute is TransitionRoute<dynamic> && canTransitionTo(nextRoute) && nextRoute.canTransitionFrom(this)) {
       Animation<double> current = _forwardAnimation.parent;
       if (current != null) {
         if (current is TrainHoppingAnimation) {
@@ -216,13 +216,13 @@
   ///
   /// Subclasses can override this function to restrict the set of routes they
   /// need to coordinate transitions with.
-  bool canTransitionTo(TransitionRoute nextRoute) => true;
+  bool canTransitionTo(TransitionRoute<dynamic> nextRoute) => true;
 
   /// Whether this route can perform a transition from the given route.
   ///
   /// Subclasses can override this function to restrict the set of routes they
   /// need to coordinate transitions with.
-  bool canTransitionFrom(TransitionRoute nextRoute) => true;
+  bool canTransitionFrom(TransitionRoute<dynamic> nextRoute) => true;
 
   void finished() {
     super.finished();
@@ -245,7 +245,7 @@
   /// Called when this entry is removed from the history of its associated [LocalHistoryRoute].
   final VoidCallback onRemove;
 
-  LocalHistoryRoute _owner;
+  LocalHistoryRoute<dynamic> _owner;
 
   /// Remove this entry from the history of its associated [LocalHistoryRoute].
   void remove() {
@@ -323,7 +323,7 @@
   }
 
   final bool isCurrent;
-  final Route route;
+  final Route<dynamic> route;
 
   bool updateShouldNotify(_ModalScopeStatus old) {
     return isCurrent != old.isCurrent ||
@@ -342,7 +342,7 @@
     this.route
   }) : super(key: key);
 
-  final ModalRoute route;
+  final ModalRoute<dynamic> route;
 
   _ModalScopeState createState() => new _ModalScopeState();
 }
@@ -444,7 +444,7 @@
   /// Returns the modal route most closely associated with the given context.
   ///
   /// Returns null if the given context is not associated with a modal route.
-  static ModalRoute of(BuildContext context) {
+  static ModalRoute<dynamic> of(BuildContext context) {
     _ModalScopeStatus widget = context.inheritFromWidgetOfExactType(_ModalScopeStatus);
     return widget?.route;
   }
@@ -581,8 +581,8 @@
 abstract class PopupRoute<T> extends ModalRoute<T> {
   PopupRoute({ Completer<T> completer }) : super(completer: completer);
   bool get opaque => false;
-  void didChangeNext(Route nextRoute) {
-    assert(nextRoute is! PageRoute);
+  void didChangeNext(Route<dynamic> nextRoute) {
+    assert(nextRoute is! PageRoute<dynamic>);
     super.didChangeNext(nextRoute);
   }
 }
diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart
index 2ecbc81..bb52511 100644
--- a/packages/flutter/lib/src/widgets/scrollable.dart
+++ b/packages/flutter/lib/src/widgets/scrollable.dart
@@ -112,13 +112,13 @@
   }
 
   /// Scrolls the closest enclosing scrollable to make the given context visible.
-  static Future ensureVisible(BuildContext context, { Duration duration, Curve curve: Curves.ease }) {
+  static Future<Null> ensureVisible(BuildContext context, { Duration duration, Curve curve: Curves.ease }) {
     assert(context.findRenderObject() is RenderBox);
     // TODO(abarth): This function doesn't handle nested scrollable widgets.
 
     ScrollableState scrollable = Scrollable.of(context);
     if (scrollable == null)
-      return new Future.value();
+      return new Future<Null>.value();
 
     RenderBox targetBox = context.findRenderObject();
     assert(targetBox.attached);
@@ -162,7 +162,7 @@
     } else if (targetMax > scrollableMax) {
       scrollOffsetDelta = targetMax - scrollableMax;
     } else {
-      return new Future.value();
+      return new Future<Null>.value();
     }
 
     ExtentScrollBehavior scrollBehavior = scrollable.scrollBehavior;
@@ -172,13 +172,14 @@
     if (scrollOffset != scrollable.scrollOffset)
       return scrollable.scrollTo(scrollOffset, duration: duration, curve: curve);
 
-    return new Future.value();
+    return new Future<Null>.value();
   }
 
   ScrollableState createState();
 }
 
-/// Contains the state for common scrolling widgets.
+/// Contains the state for common scrolling widgets that scroll only
+/// along one axis.
 ///
 /// Widgets that subclass [Scrollable] typically use state objects
 /// that subclass [ScrollableState].
@@ -299,14 +300,14 @@
   /// Scroll behaviors control where the boundaries of the scrollable are placed
   /// and how the scrolling physics should behave near those boundaries and
   /// after the user stops directly manipulating the scrollable.
-  ScrollBehavior get scrollBehavior {
+  ScrollBehavior<double, double> get scrollBehavior {
     return _scrollBehavior ??= createScrollBehavior();
   }
-  ScrollBehavior _scrollBehavior;
+  ScrollBehavior<double, double> _scrollBehavior;
 
   /// Subclasses should override this function to create the [ScrollBehavior]
   /// they desire.
-  ScrollBehavior createScrollBehavior();
+  ScrollBehavior<double, double> createScrollBehavior();
 
   bool _scrollOffsetIsInBounds(double scrollOffset) {
     if (scrollBehavior is! ExtentScrollBehavior)
@@ -336,7 +337,7 @@
   ///
   /// If a non-null [duration] is provided, the widget will animate to the new
   /// scroll offset over the given duration with the given curve.
-  Future scrollBy(double scrollDelta, { Duration duration, Curve curve: Curves.ease }) {
+  Future<Null> scrollBy(double scrollDelta, { Duration duration, Curve curve: Curves.ease }) {
     double newScrollOffset = scrollBehavior.applyCurve(_scrollOffset, scrollDelta);
     return scrollTo(newScrollOffset, duration: duration, curve: curve);
   }
@@ -349,21 +350,21 @@
   /// This function does not accept a zero duration. To jump-scroll to
   /// the new offset, do not provide a duration, rather than providing
   /// a zero duration.
-  Future scrollTo(double newScrollOffset, { Duration duration, Curve curve: Curves.ease }) {
+  Future<Null> scrollTo(double newScrollOffset, { Duration duration, Curve curve: Curves.ease }) {
     if (newScrollOffset == _scrollOffset)
-      return new Future.value();
+      return new Future<Null>.value();
 
     if (duration == null) {
       _controller.stop();
       _setScrollOffset(newScrollOffset);
-      return new Future.value();
+      return new Future<Null>.value();
     }
 
     assert(duration > Duration.ZERO);
     return _animateTo(newScrollOffset, duration, curve);
   }
 
-  Future _animateTo(double newScrollOffset, Duration duration, Curve curve) {
+  Future<Null> _animateTo(double newScrollOffset, Duration duration, Curve curve) {
     _controller.stop();
     _controller.value = scrollOffset;
     _startScroll();
@@ -375,10 +376,10 @@
   /// Calling this function starts a physics-based animation of the scroll
   /// offset with the given value as the initial velocity. The physics
   /// simulation used is determined by the scroll behavior.
-  Future fling(double scrollVelocity) {
+  Future<Null> fling(double scrollVelocity) {
     if (scrollVelocity != 0.0 || !_controller.isAnimating)
       return _startToEndAnimation(scrollVelocity);
-    return new Future.value();
+    return new Future<Null>.value();
   }
 
   /// Animate the scroll offset to a value with a local minima of energy.
@@ -386,15 +387,15 @@
   /// Calling this function starts a physics-based animation of the scroll
   /// offset either to a snap point or to within the scrolling bounds. The
   /// physics simulation used is determined by the scroll behavior.
-  Future settleScrollOffset() {
+      Future<Null> settleScrollOffset() {
     return _startToEndAnimation(0.0);
   }
 
-  Future _startToEndAnimation(double scrollVelocity) {
+  Future<Null> _startToEndAnimation(double scrollVelocity) {
     _controller.stop();
     Simulation simulation = _createSnapSimulation(scrollVelocity) ?? _createFlingSimulation(scrollVelocity);
     if (simulation == null)
-      return new Future.value();
+      return new Future<Null>.value();
     _startScroll();
     return _controller.animateWith(simulation).then(_endScroll);
   }
@@ -493,7 +494,7 @@
     scrollBy(pixelOffsetToScrollOffset(delta));
   }
 
-  Future _handleDragEnd(Velocity velocity) {
+  Future<Null> _handleDragEnd(Velocity velocity) {
     double scrollVelocity = pixelDeltaToScrollOffset(velocity.pixelsPerSecond) / Duration.MILLISECONDS_PER_SECOND;
     // The gesture velocity properties are pixels/second, config min,max limits are pixels/ms
     return fling(scrollVelocity.clamp(-kMaxFlingVelocity, kMaxFlingVelocity)).then(_endScroll);
@@ -631,7 +632,7 @@
 }
 
 class _ScrollableViewportState extends ScrollableState<ScrollableViewport> {
-  ScrollBehavior createScrollBehavior() => new OverscrollWhenScrollableBehavior();
+  ScrollBehavior<double, double> createScrollBehavior() => new OverscrollWhenScrollableBehavior();
   OverscrollWhenScrollableBehavior get scrollBehavior => super.scrollBehavior;
 
   double _viewportSize = 0.0;
@@ -745,13 +746,13 @@
   /// Called when a scroll starts. Subclasses may override this method to
   /// initialize some state or to play an animation. The returned Future should
   /// complete when the computation triggered by this method has finished.
-  Future scrollStarted() => new Future.value();
+  Future<Null> scrollStarted() => new Future<Null>.value();
 
 
   /// Similar to scrollStarted(). Called when a scroll ends. For fling scrolls
   /// "ended" means that the scroll animation either stopped of its own accord
   /// or was canceled  by the user.
-  Future scrollEnded() => new Future.value();
+  Future<Null> scrollEnded() => new Future<Null>.value();
 }
 
 /// A general scrollable list for a large number of children that might not all
@@ -793,7 +794,7 @@
     );
   }
 
-  ScrollBehavior createScrollBehavior() => new OverscrollBehavior();
+  ScrollBehavior<double, double> createScrollBehavior() => new OverscrollBehavior();
   OverscrollBehavior get scrollBehavior => super.scrollBehavior;
 
   Offset _handlePaintOffsetUpdateNeeded(ViewportDimensions dimensions) {
diff --git a/packages/flutter/lib/src/widgets/scrollable_grid.dart b/packages/flutter/lib/src/widgets/scrollable_grid.dart
index 8833307..5b12a9d 100644
--- a/packages/flutter/lib/src/widgets/scrollable_grid.dart
+++ b/packages/flutter/lib/src/widgets/scrollable_grid.dart
@@ -41,7 +41,7 @@
 }
 
 class _ScrollableGridState extends ScrollableState<ScrollableGrid> {
-  ScrollBehavior createScrollBehavior() => new OverscrollBehavior();
+  ScrollBehavior<double, double> createScrollBehavior() => new OverscrollBehavior();
   ExtentScrollBehavior get scrollBehavior => super.scrollBehavior;
 
   void _handleExtentsChanged(double contentExtent, double containerExtent) {
@@ -85,9 +85,11 @@
   _GridViewportElement createElement() => new _GridViewportElement(this);
 }
 
-class _GridViewportElement extends VirtualViewportElement<GridViewport> {
+class _GridViewportElement extends VirtualViewportElement {
   _GridViewportElement(GridViewport widget) : super(widget);
 
+  GridViewport get widget => super.widget;
+
   RenderGrid get renderObject => super.renderObject;
 
   int get materializedChildBase => _materializedChildBase;
diff --git a/packages/flutter/lib/src/widgets/scrollable_list.dart b/packages/flutter/lib/src/widgets/scrollable_list.dart
index bc55ed5..6e73eb6 100644
--- a/packages/flutter/lib/src/widgets/scrollable_list.dart
+++ b/packages/flutter/lib/src/widgets/scrollable_list.dart
@@ -45,7 +45,7 @@
 }
 
 class _ScrollableListState extends ScrollableState<ScrollableList> {
-  ScrollBehavior createScrollBehavior() => new OverscrollBehavior();
+  ScrollBehavior<double, double> createScrollBehavior() => new OverscrollBehavior();
   ExtentScrollBehavior get scrollBehavior => super.scrollBehavior;
 
   void _handleExtentsChanged(double contentExtent, double containerExtent) {
@@ -145,9 +145,11 @@
   _VirtualListViewportElement createElement() => new _VirtualListViewportElement(this);
 }
 
-class _VirtualListViewportElement extends VirtualViewportElement<_VirtualListViewport> {
+class _VirtualListViewportElement extends VirtualViewportElement {
   _VirtualListViewportElement(VirtualViewport widget) : super(widget);
 
+  _VirtualListViewport get widget => super.widget;
+
   RenderList get renderObject => super.renderObject;
 
   int get materializedChildBase => _materializedChildBase;
@@ -306,7 +308,7 @@
 }
 
 class _ScrollableLazyListState extends ScrollableState<ScrollableLazyList> {
-  ScrollBehavior createScrollBehavior() => new OverscrollBehavior();
+  ScrollBehavior<double, double> createScrollBehavior() => new OverscrollBehavior();
   ExtentScrollBehavior get scrollBehavior => super.scrollBehavior;
 
   void _handleExtentsChanged(double contentExtent, double containerExtent) {
diff --git a/packages/flutter/lib/src/widgets/semantics_debugger.dart b/packages/flutter/lib/src/widgets/semantics_debugger.dart
index 8183b36..66e1cb5 100644
--- a/packages/flutter/lib/src/widgets/semantics_debugger.dart
+++ b/packages/flutter/lib/src/widgets/semantics_debugger.dart
@@ -296,12 +296,12 @@
     }
     entry.updateMessage();
     if (node.children != null) {
-      Set oldChildren = new Set<_SemanticsDebuggerEntry>.from(entry.children ?? const <_SemanticsDebuggerEntry>[]);
+      Set<_SemanticsDebuggerEntry> oldChildren = new Set<_SemanticsDebuggerEntry>.from(entry.children ?? const <_SemanticsDebuggerEntry>[]);
       entry.children?.clear();
       entry.children ??= new List<_SemanticsDebuggerEntry>();
       for (mojom.SemanticsNode child in node.children)
         entry.children.add(_updateNode(child));
-      Set newChildren = new Set<_SemanticsDebuggerEntry>.from(entry.children);
+      Set<_SemanticsDebuggerEntry> newChildren = new Set<_SemanticsDebuggerEntry>.from(entry.children);
       Set<_SemanticsDebuggerEntry> removedChildren = oldChildren.difference(newChildren);
       for (_SemanticsDebuggerEntry oldChild in removedChildren)
         nodes.remove(oldChild.id);
diff --git a/packages/flutter/lib/src/widgets/virtual_viewport.dart b/packages/flutter/lib/src/widgets/virtual_viewport.dart
index af672f1..07a5ecd 100644
--- a/packages/flutter/lib/src/widgets/virtual_viewport.dart
+++ b/packages/flutter/lib/src/widgets/virtual_viewport.dart
@@ -31,8 +31,10 @@
 /// This class is a building block for building a widget that has more children
 /// than it wishes to display at any given time. For example, [ScrollableList]
 /// uses this element to materialize only those children that are visible.
-abstract class VirtualViewportElement<T extends VirtualViewport> extends RenderObjectElement<T> {
-  VirtualViewportElement(T widget) : super(widget);
+abstract class VirtualViewportElement extends RenderObjectElement {
+  VirtualViewportElement(VirtualViewport widget) : super(widget);
+
+  VirtualViewport get widget => super.widget;
 
   /// The index of the first child to materialize.
   int get materializedChildBase;
@@ -70,7 +72,7 @@
 
   List<Element> _materializedChildren = const <Element>[];
 
-  RenderVirtualViewport get renderObject => super.renderObject;
+  RenderVirtualViewport<dynamic> get renderObject => super.renderObject;
 
   void visitChildren(ElementVisitor visitor) {
     if (_materializedChildren == null)
@@ -94,8 +96,8 @@
     super.unmount();
   }
 
-  void update(T newWidget) {
-    T oldWidget = widget;
+  void update(VirtualViewport newWidget) {
+    VirtualViewport oldWidget = widget;
     _widgetProvider.didUpdateWidget(oldWidget, newWidget);
     super.update(newWidget);
     updateRenderObject(oldWidget);
@@ -107,7 +109,7 @@
     renderObject.paintOffset = scrollOffsetToPixelDelta(widget.startOffset - startOffsetBase);
   }
 
-  void updateRenderObject(T oldWidget) {
+  void updateRenderObject(VirtualViewport oldWidget) {
     renderObject.virtualChildCount = _widgetProvider.virtualChildCount;
 
     if (startOffsetBase != null) {
@@ -161,7 +163,7 @@
     for (int i = 0; i < count; ++i) {
       int childIndex = base + i;
       Widget child = _widgetProvider.getChild(childIndex);
-      Key key = new ValueKey(child.key ?? childIndex);
+      Key key = new ValueKey<Key>(child.key) ?? new ValueKey<int>(childIndex);
       newWidgets[i] = new RepaintBoundary(key: key, child: child);
     }
     _materializedChildren = updateChildren(_materializedChildren, newWidgets);
diff --git a/packages/flutter/test/rendering/box_test.dart b/packages/flutter/test/rendering/box_test.dart
index 7c42c4c..e9db8be 100644
--- a/packages/flutter/test/rendering/box_test.dart
+++ b/packages/flutter/test/rendering/box_test.dart
@@ -64,10 +64,10 @@
   });
 
   test("should not have a 0 sized colored Box", () {
-    var coloredBox = new RenderDecoratedBox(
+    RenderBox coloredBox = new RenderDecoratedBox(
       decoration: new BoxDecoration()
     );
-    var paddingBox = new RenderPadding(padding: const EdgeDims.all(10.0),
+    RenderBox paddingBox = new RenderPadding(padding: const EdgeDims.all(10.0),
         child: coloredBox);
     RenderBox root = new RenderDecoratedBox(
       decoration: new BoxDecoration(),
diff --git a/packages/flutter/test/widget/asset_vendor_test.dart b/packages/flutter/test/widget/asset_vendor_test.dart
index a25a0e5..009f636 100644
--- a/packages/flutter/test/widget/asset_vendor_test.dart
+++ b/packages/flutter/test/widget/asset_vendor_test.dart
@@ -107,11 +107,11 @@
   );
 }
 
-RenderImage getRenderImage(tester, Key key) {
+RenderImage getRenderImage(WidgetTester tester, Key key) {
   return tester.findElementByKey(key).renderObject;
 }
 
-TestImage getTestImage(tester, Key key) {
+TestImage getTestImage(WidgetTester tester, Key key) {
   return getRenderImage(tester, key).image;
 }
 
diff --git a/packages/flutter/test/widget/bottom_sheet_rebuild_test.dart b/packages/flutter/test/widget/bottom_sheet_rebuild_test.dart
index b5f2a5a..21ce1d8 100644
--- a/packages/flutter/test/widget/bottom_sheet_rebuild_test.dart
+++ b/packages/flutter/test/widget/bottom_sheet_rebuild_test.dart
@@ -10,7 +10,7 @@
   test('Verify that a BottomSheet can be rebuilt with ScaffoldFeatureController.setState()', () {
     testWidgets((WidgetTester tester) {
       final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
-      ScaffoldFeatureController bottomSheet;
+      PersistentBottomSheetController<Null> bottomSheet;
       int buildCount = 0;
 
       tester.pumpWidget(new MaterialApp(
@@ -24,7 +24,7 @@
         }
       ));
 
-      bottomSheet = scaffoldKey.currentState.showBottomSheet((_) {
+      bottomSheet = scaffoldKey.currentState.showBottomSheet/*<Null>*/((_) {
         return new Builder(
           builder: (_) {
             buildCount += 1;
diff --git a/packages/flutter/test/widget/bottom_sheet_test.dart b/packages/flutter/test/widget/bottom_sheet_test.dart
index 5aed8bc..a2da8db 100644
--- a/packages/flutter/test/widget/bottom_sheet_test.dart
+++ b/packages/flutter/test/widget/bottom_sheet_test.dart
@@ -25,10 +25,11 @@
       tester.pump();
       expect(tester.findText('BottomSheet'), isNull);
 
-      showModalBottomSheet(
+      showModalBottomSheet/*<Null>*/(
         context: context,
         builder: (BuildContext context) => new Text('BottomSheet')
-      ).then((_) {
+      ).then((Null result) {
+        expect(result, isNull);
         showBottomSheetThenCalled = true;
       });
 
@@ -45,7 +46,7 @@
       tester.pump(new Duration(seconds: 1)); // frame after the animation (sheet has been removed)
       expect(tester.findText('BottomSheet'), isNull);
 
-      showModalBottomSheet(context: context, builder: (BuildContext context) => new Text('BottomSheet'));
+      showModalBottomSheet/*<Null>*/(context: context, builder: (BuildContext context) => new Text('BottomSheet'));
       tester.pump(); // bottom sheet show animation starts
       tester.pump(new Duration(seconds: 1)); // animation done
       expect(tester.findText('BottomSheet'), isNotNull);
diff --git a/packages/flutter/test/widget/custom_one_child_layout_test.dart b/packages/flutter/test/widget/custom_one_child_layout_test.dart
index ecf7506..086831f 100644
--- a/packages/flutter/test/widget/custom_one_child_layout_test.dart
+++ b/packages/flutter/test/widget/custom_one_child_layout_test.dart
@@ -46,7 +46,7 @@
   }
 }
 
-Widget buildFrame(delegate) {
+Widget buildFrame(OneChildLayoutDelegate delegate) {
   return new Center(child: new CustomOneChildLayout(delegate: delegate, child: new Container()));
 }
 
diff --git a/packages/flutter/test/widget/draggable_test.dart b/packages/flutter/test/widget/draggable_test.dart
index 603b326..cd417d6 100644
--- a/packages/flutter/test/widget/draggable_test.dart
+++ b/packages/flutter/test/widget/draggable_test.dart
@@ -15,19 +15,19 @@
         routes: <String, RouteBuilder>{
           '/': (RouteArguments args) { return new Column(
             children: <Widget>[
-              new Draggable(
+              new Draggable<int>(
                 data: 1,
                 child: new Text('Source'),
                 feedback: new Text('Dragging')
               ),
-              new DragTarget(
-                builder: (context, data, rejects) {
+              new DragTarget<int>(
+                builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
                   return new Container(
                     height: 100.0,
                     child: new Text('Target')
                   );
                 },
-                onAccept: (data) {
+                onAccept: (int data) {
                   accepted.add(data);
                 }
               ),
@@ -78,7 +78,7 @@
         routes: <String, RouteBuilder>{
           '/': (RouteArguments args) { return new Column(
             children: <Widget>[
-              new Draggable(
+              new Draggable<int>(
                 data: 1,
                 child: new Text('Source'),
                 feedback: new Text('Dragging')
@@ -94,15 +94,15 @@
                       child: new Text('Button')
                     )
                   ),
-                  new DragTarget(
-                    builder: (context, data, rejects) {
+                  new DragTarget<int>(
+                    builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
                       return new IgnorePointer(
                         child: new Container(
                           child: new Text('Target')
                         )
                       );
                     },
-                    onAccept: (data) {
+                    onAccept: (int data) {
                       events.add('drop');
                     }
                   ),
@@ -176,7 +176,7 @@
         routes: <String, RouteBuilder>{
           '/': (RouteArguments args) { return new Column(
             children: <Widget>[
-              new Draggable(
+              new Draggable<int>(
                 data: 1,
                 child: new GestureDetector(
                   behavior: HitTestBehavior.opaque,
@@ -189,11 +189,11 @@
                 ),
                 feedback: new Text('Dragging')
               ),
-              new DragTarget(
-                builder: (context, data, rejects) {
+              new DragTarget<int>(
+                builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
                   return new Text('Target');
                 },
-                onAccept: (data) {
+                onAccept: (int data) {
                   events.add('drop');
                 }
               ),
@@ -237,16 +237,16 @@
         routes: <String, RouteBuilder>{
           '/': (RouteArguments args) { return new Column(
             children: <Widget>[
-              new LongPressDraggable(
+              new LongPressDraggable<int>(
                 data: 1,
                 child: new Text('Source'),
                 feedback: new Text('Dragging')
               ),
-              new DragTarget(
-                builder: (context, data, rejects) {
+              new DragTarget<int>(
+                builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
                   return new Text('Target');
                 },
-                onAccept: (data) {
+                onAccept: (int data) {
                   events.add('drop');
                 }
               ),
@@ -288,16 +288,16 @@
         routes: <String, RouteBuilder>{
           '/': (RouteArguments args) { return new Column(
             children: <Widget>[
-              new Draggable(
+              new Draggable<int>(
                 data: 1,
                 child: new Text('Source'),
                 feedback: new Text('Dragging')
               ),
-              new DragTarget(
-                builder: (context, data, rejects) {
+              new DragTarget<int>(
+                builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
                   return new Text('Target');
                 },
-                onAccept: (data) {
+                onAccept: (int data) {
                   events.add('drop');
                 }
               ),
@@ -341,21 +341,21 @@
           '/': (RouteArguments args) {
             return new Block(
               children: <Widget>[
-                new DragTarget(
-                  builder: (context, data, rejects) {
+                new DragTarget<int>(
+                  builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
                     return new Text('Target');
                   },
-                  onAccept: (data) {
+                  onAccept: (int data) {
                     events.add('drop $data');
                   }
                 ),
                 new Container(height: 400.0),
-                new HorizontalDraggable(
+                new HorizontalDraggable<int>(
                   data: 1,
                   child: new Text('H'),
                   feedback: new Text('Dragging')
                 ),
-                new VerticalDraggable(
+                new VerticalDraggable<int>(
                   data: 2,
                   child: new Text('V'),
                   feedback: new Text('Dragging')
@@ -453,21 +453,21 @@
             return new Block(
               scrollDirection: Axis.horizontal,
               children: <Widget>[
-                new DragTarget(
-                  builder: (context, data, rejects) {
+                new DragTarget<int>(
+                  builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
                     return new Text('Target');
                   },
-                  onAccept: (data) {
+                  onAccept: (int data) {
                     events.add('drop $data');
                   }
                 ),
                 new Container(width: 400.0),
-                new HorizontalDraggable(
+                new HorizontalDraggable<int>(
                   data: 1,
                   child: new Text('H'),
                   feedback: new Text('Dragging')
                 ),
-                new VerticalDraggable(
+                new VerticalDraggable<int>(
                   data: 2,
                   child: new Text('V'),
                   feedback: new Text('Dragging')
diff --git a/packages/flutter/test/widget/heroes_test.dart b/packages/flutter/test/widget/heroes_test.dart
index deefffa..3771893 100644
--- a/packages/flutter/test/widget/heroes_test.dart
+++ b/packages/flutter/test/widget/heroes_test.dart
@@ -31,7 +31,7 @@
   ),
 };
 
-class ThreeRoute extends MaterialPageRoute {
+class ThreeRoute extends MaterialPageRoute<Null> {
   ThreeRoute() : super(builder: (BuildContext context) {
     return new Material(
       child: new Block(children: <Widget>[
diff --git a/packages/flutter/test/widget/modal_barrier_test.dart b/packages/flutter/test/widget/modal_barrier_test.dart
index fa7627d..904f865 100644
--- a/packages/flutter/test/widget/modal_barrier_test.dart
+++ b/packages/flutter/test/widget/modal_barrier_test.dart
@@ -69,7 +69,7 @@
       tester.pumpWidget(new MaterialApp(routes: routes));
 
       // Initially the barrier is not visible
-      expect(tester.findElementByKey(const ValueKey('barrier')), isNull);
+      expect(tester.findElementByKey(const ValueKey<String>('barrier')), isNull);
 
       // Tapping on X routes to the barrier
       tester.tap(tester.findText('X'));
@@ -77,11 +77,11 @@
       tester.pump(const Duration(seconds: 1));  // end transition
 
       // Tap on the barrier to dismiss it
-      tester.tap(tester.findElementByKey(const ValueKey('barrier')));
+      tester.tap(tester.findElementByKey(const ValueKey<String>('barrier')));
       tester.pump();  // begin transition
       tester.pump(const Duration(seconds: 1));  // end transition
 
-      expect(tester.findElementByKey(const ValueKey('barrier')), isNull,
+      expect(tester.findElementByKey(const ValueKey<String>('barrier')), isNull,
         reason: 'because the barrier was dismissed');
     });
   });
@@ -103,7 +103,7 @@
 class SecondComponent extends StatelessComponent {
   Widget build(BuildContext context) {
     return new ModalBarrier(
-      key: const ValueKey('barrier'),
+      key: const ValueKey<String>('barrier'),
       dismissable: true
     );
   }
diff --git a/packages/flutter/test/widget/navigator_test.dart b/packages/flutter/test/widget/navigator_test.dart
index b441f6e..80c6dc1 100644
--- a/packages/flutter/test/widget/navigator_test.dart
+++ b/packages/flutter/test/widget/navigator_test.dart
@@ -40,7 +40,7 @@
   }
 }
 
-typedef void ExceptionCallback(exception);
+typedef void ExceptionCallback(dynamic exception);
 
 class ThirdComponent extends StatelessComponent {
   ThirdComponent({ this.targetKey, this.onException });
@@ -103,7 +103,7 @@
       dynamic exception;
       Widget widget = new ThirdComponent(
         targetKey: targetKey,
-        onException: (e) {
+        onException: (dynamic e) {
           exception = e;
         }
       );
diff --git a/packages/flutter/test/widget/page_forward_transitions_test.dart b/packages/flutter/test/widget/page_forward_transitions_test.dart
index 98e7a38..7b3bf5d 100644
--- a/packages/flutter/test/widget/page_forward_transitions_test.dart
+++ b/packages/flutter/test/widget/page_forward_transitions_test.dart
@@ -70,12 +70,12 @@
           onGenerateRoute: (RouteSettings settings) {
             switch (settings.name) {
               case '/':
-                return new TestRoute(
+                return new TestRoute<Null>(
                   settings: settings,
                   child: new Builder(
                     key: insideKey,
                     builder: (BuildContext context) {
-                      PageRoute route = ModalRoute.of(context);
+                      PageRoute<Null> route = ModalRoute.of(context);
                       return new Column(
                         children: <Widget>[
                           new TestTransition(
@@ -93,9 +93,9 @@
                     }
                   )
                 );
-              case '/2': return new TestRoute(settings: settings, child: new Text('E'));
-              case '/3': return new TestRoute(settings: settings, child: new Text('F'));
-              case '/4': return new TestRoute(settings: settings, child: new Text('G'));
+              case '/2': return new TestRoute<Null>(settings: settings, child: new Text('E'));
+              case '/3': return new TestRoute<Null> (settings: settings, child: new Text('F'));
+              case '/4': return new TestRoute<Null> (settings: settings, child: new Text('G'));
             }
           }
         )
diff --git a/packages/flutter/test/widget/page_transitions_test.dart b/packages/flutter/test/widget/page_transitions_test.dart
index 02ac7e0..8480dff 100644
--- a/packages/flutter/test/widget/page_transitions_test.dart
+++ b/packages/flutter/test/widget/page_transitions_test.dart
@@ -8,7 +8,7 @@
 
 import 'test_matchers.dart';
 
-class TestOverlayRoute extends OverlayRoute {
+class TestOverlayRoute extends OverlayRoute<Null> {
   List<WidgetBuilder> get builders => <WidgetBuilder>[ _build ];
   Widget _build(BuildContext context) => new Text('Overlay');
 }
diff --git a/packages/flutter/test/widget/remember_scroll_position_test.dart b/packages/flutter/test/widget/remember_scroll_position_test.dart
index 720e8de..4c166f3 100644
--- a/packages/flutter/test/widget/remember_scroll_position_test.dart
+++ b/packages/flutter/test/widget/remember_scroll_position_test.dart
@@ -28,9 +28,9 @@
         key: navigatorKey,
         onGenerateRoute: (RouteSettings settings) {
           if (settings.name == '/')
-            return new MaterialPageRoute(builder: (_) => new Container(child: new ThePositiveNumbers()));
+            return new MaterialPageRoute<Null>(builder: (_) => new Container(child: new ThePositiveNumbers()));
           else if (settings.name == '/second')
-            return new MaterialPageRoute(builder: (_) => new Container(child: new ThePositiveNumbers()));
+            return new MaterialPageRoute<Null>(builder: (_) => new Container(child: new ThePositiveNumbers()));
           return null;
         }
       ));
@@ -47,9 +47,10 @@
       expect(tester.findText('10'), isNull);
       expect(tester.findText('100'), isNull);
 
-      StatefulComponentElement<ScrollableLazyList, ScrollableState<ScrollableLazyList>> target =
+      StatefulComponentElement target =
         tester.findElement((Element element) => element.widget is ScrollableLazyList);
-      target.state.scrollTo(1000.0);
+      ScrollableState targetState = target.state;
+      targetState.scrollTo(1000.0);
       tester.pump(new Duration(seconds: 1));
 
       // we're 600 pixels high, each item is 100 pixels high, scroll position is
diff --git a/packages/flutter/test/widget/snack_bar_test.dart b/packages/flutter/test/widget/snack_bar_test.dart
index bfd9c67..eedafef 100644
--- a/packages/flutter/test/widget/snack_bar_test.dart
+++ b/packages/flutter/test/widget/snack_bar_test.dart
@@ -144,7 +144,7 @@
       int snackBarCount = 0;
       Key tapTarget = new Key('tap-target');
       int time;
-      ScaffoldFeatureController<SnackBar> lastController;
+      ScaffoldFeatureController<SnackBar, Null> lastController;
       tester.pumpWidget(new MaterialApp(
         routes: <String, RouteBuilder>{
           '/': (RouteArguments args) {
@@ -176,7 +176,7 @@
       expect(tester.findText('bar2'), isNull);
       time = 1000;
       tester.tap(tester.findElementByKey(tapTarget)); // queue bar1
-      ScaffoldFeatureController<SnackBar> firstController = lastController;
+      ScaffoldFeatureController<SnackBar, Null> firstController = lastController;
       time = 2;
       tester.tap(tester.findElementByKey(tapTarget)); // queue bar2
       expect(tester.findText('bar1'), isNull);
diff --git a/packages/flutter/test/widget/snap_scrolling_test.dart b/packages/flutter/test/widget/snap_scrolling_test.dart
index 413c047..01984f1 100644
--- a/packages/flutter/test/widget/snap_scrolling_test.dart
+++ b/packages/flutter/test/widget/snap_scrolling_test.dart
@@ -47,7 +47,7 @@
   scrollableState.scrollTo(value);
 }
 
-Future fling(double velocity) {
+Future<Null> fling(double velocity) {
   return scrollableState.fling(velocity);
 }
 
diff --git a/packages/flutter/test/widget/stack_test.dart b/packages/flutter/test/widget/stack_test.dart
index 954f891..dfb109b 100644
--- a/packages/flutter/test/widget/stack_test.dart
+++ b/packages/flutter/test/widget/stack_test.dart
@@ -155,7 +155,7 @@
 
       Widget buildFrame(int index) {
         itemsPainted = <int>[];
-        List<Widget> items = new List<Widget>.generate(itemCount, (i) {
+        List<Widget> items = new List<Widget>.generate(itemCount, (int i) {
           return new CustomPaint(
             child: new Text('$i'),
             painter: new TestCallbackPainter(
@@ -188,7 +188,7 @@
 
       Widget buildFrame(int index) {
         itemsTapped = <int>[];
-        List<Widget> items = new List<Widget>.generate(itemCount, (i) {
+        List<Widget> items = new List<Widget>.generate(itemCount, (int i) {
           return new GestureDetector(child: new Text('$i'), onTap: () { itemsTapped.add(i); });
         });
         return new Center(child: new IndexedStack(children: items, key: key, index: index));
diff --git a/packages/flutter/test/widget/test_matchers.dart b/packages/flutter/test/widget/test_matchers.dart
index 5797347..2b395fa 100644
--- a/packages/flutter/test/widget/test_matchers.dart
+++ b/packages/flutter/test/widget/test_matchers.dart
@@ -20,25 +20,25 @@
 
 class _IsOnStage extends Matcher {
   const _IsOnStage();
-  bool matches(item, Map matchState) => !_hasAncestorOfType(item, OffStage);
+  bool matches(Element item, Map<dynamic, dynamic> matchState) => !_hasAncestorOfType(item, OffStage);
   Description describe(Description description) => description.add('onstage');
 }
 
 class _IsOffStage extends Matcher {
   const _IsOffStage();
-  bool matches(item, Map matchState) => _hasAncestorOfType(item, OffStage);
+  bool matches(Element item, Map<dynamic, dynamic> matchState) => _hasAncestorOfType(item, OffStage);
   Description describe(Description description) => description.add('offstage');
 }
 
 class _IsInCard extends Matcher {
   const _IsInCard();
-  bool matches(item, Map matchState) => _hasAncestorOfType(item, Card);
+  bool matches(Element item, Map<dynamic, dynamic> matchState) => _hasAncestorOfType(item, Card);
   Description describe(Description description) => description.add('in card');
 }
 
 class _IsNotInCard extends Matcher {
   const _IsNotInCard();
-  bool matches(item, Map matchState) => !_hasAncestorOfType(item, Card);
+  bool matches(Element item, Map<dynamic, dynamic> matchState) => !_hasAncestorOfType(item, Card);
   Description describe(Description description) => description.add('not in card');
 }
 
diff --git a/packages/flutter_driver/lib/src/driver.dart b/packages/flutter_driver/lib/src/driver.dart
index 0a7a148..39625af 100644
--- a/packages/flutter_driver/lib/src/driver.dart
+++ b/packages/flutter_driver/lib/src/driver.dart
@@ -55,7 +55,7 @@
     //
     // See: https://github.com/dart-lang/sdk/issues/25902
     if (isolate.pauseEvent is VMResumeEvent) {
-      await new Future.delayed(new Duration(milliseconds: 300));
+      await new Future<Null>.delayed(new Duration(milliseconds: 300));
       isolate = await vm.isolates.first.loadRunnable();
     }
 
@@ -64,10 +64,10 @@
     // Attempts to resume the isolate, but does not crash if it fails because
     // the isolate is already resumed. There could be a race with other tools,
     // such as a debugger, any of which could have resumed the isolate.
-    Future resumeLeniently() {
+    Future<Null> resumeLeniently() {
       _log.trace('Attempting to resume isolate');
-      return isolate.resume().catchError((e) {
-        const vmMustBePausedCode = 101;
+      return isolate.resume().catchError((dynamic e) {
+        const int vmMustBePausedCode = 101;
         if (e is rpc.RpcException && e.code == vmMustBePausedCode) {
           // No biggie; something else must have resumed the isolate
           _log.warning(
@@ -87,7 +87,7 @@
       _log.trace('Isolate is paused at start.');
 
       // Waits for a signal from the VM service that the extension is registered
-      Future waitForServiceExtension() {
+      Future<Null> waitForServiceExtension() {
         return isolate.onExtensionAdded.firstWhere((String extension) {
           return extension == _kFlutterExtensionMethod;
         });
@@ -96,8 +96,8 @@
       // If the isolate is paused at the start, e.g. via the --start-paused
       // option, then the VM service extension is not registered yet. Wait for
       // it to be registered.
-      Future whenResumed = resumeLeniently();
-      Future whenServiceExtensionReady = Future.any(<Future>[
+      Future<Null> whenResumed = resumeLeniently();
+      Future<Null> whenServiceExtensionReady = Future.any(<Future<dynamic>>[
         waitForServiceExtension(),
         // We will never receive the extension event if the user does not
         // register it. If that happens time out.
@@ -150,7 +150,7 @@
     Map<String, String> parameters = <String, String>{'command': command.kind}
       ..addAll(command.serialize());
     return _appIsolate.invokeExtension(_kFlutterExtensionMethod, parameters)
-      .then((Map<String, dynamic> result) => result, onError: (error, stackTrace) {
+      .then((Map<String, dynamic> result) => result, onError: (dynamic error, dynamic stackTrace) {
         throw new DriverError(
           'Failed to fulfill ${command.runtimeType} due to remote error',
           error,
@@ -217,7 +217,7 @@
       dynamic value = await evaluator();
       MatchResult matchResult = match(value, matcher);
       if (!matchResult.hasMatched) {
-        return new Future.error(matchResult.mismatchDescription);
+        return new Future<Null>.error(matchResult.mismatchDescription);
       }
       return value;
     }, timeout, pauseBetweenRetries);
@@ -227,7 +227,7 @@
   ///
   /// Returns a [Future] that fires once the connection has been closed.
   // TODO(yjbanov): cleanup object references
-  Future close() => _serviceClient.close().then((_) {
+  Future<Null> close() => _serviceClient.close().then((_) {
     // Don't leak vm_service_client-specific objects, if any
     return null;
   });
@@ -255,10 +255,10 @@
   Stopwatch timer = new Stopwatch();
   Future<VMServiceClient> attemptConnection() {
     return VMServiceClient.connect(url)
-      .catchError((e) async {
+      .catchError((dynamic e) async {
         if (timer.elapsed < const Duration(seconds: 30)) {
           _log.info('Waiting for application to start');
-          await new Future.delayed(const Duration(seconds: 1));
+          await new Future<Null>.delayed(const Duration(seconds: 1));
           return attemptConnection();
         } else {
           _log.critical(
diff --git a/packages/flutter_driver/lib/src/matcher_util.dart b/packages/flutter_driver/lib/src/matcher_util.dart
index e92acbc..12ab680 100644
--- a/packages/flutter_driver/lib/src/matcher_util.dart
+++ b/packages/flutter_driver/lib/src/matcher_util.dart
@@ -49,7 +49,7 @@
     return this;
   }
 
-  Description addDescriptionOf(value) {
+  Description addDescriptionOf(dynamic value) {
     if (value is Matcher) {
       value.describe(this);
       return this;
@@ -58,7 +58,7 @@
     }
   }
 
-  Description addAll(String start, String separator, String end, Iterable list) {
+  Description addAll(String start, String separator, String end, Iterable<dynamic> list) {
     add(start);
     if (list.isNotEmpty) {
       addDescriptionOf(list.first);
diff --git a/packages/flutter_driver/lib/src/retry.dart b/packages/flutter_driver/lib/src/retry.dart
index d0d80b4..bd0cccc 100644
--- a/packages/flutter_driver/lib/src/retry.dart
+++ b/packages/flutter_driver/lib/src/retry.dart
@@ -48,9 +48,9 @@
   if (success)
     return result;
   else if (lastError != null)
-    return new Future.error(lastError, lastStackTrace);
+    return new Future<Null>.error(lastError, lastStackTrace);
   else
-    return new Future.error('Retry timed out');
+    return new Future<Null>.error('Retry timed out');
 }
 
 /// A function that produces a [Stopwatch].
diff --git a/packages/flutter_sprites/lib/src/action.dart b/packages/flutter_sprites/lib/src/action.dart
index 6e6a117..d0b6cf9 100644
--- a/packages/flutter_sprites/lib/src/action.dart
+++ b/packages/flutter_sprites/lib/src/action.dart
@@ -424,7 +424,7 @@
   }
 
   void update(double t) {
-    var newVal;
+    dynamic newVal;
 
     if (startVal is Point) {
       // Point
diff --git a/packages/flutter_sprites/lib/src/physics_body.dart b/packages/flutter_sprites/lib/src/physics_body.dart
index 3a8fa47..d32fdac 100644
--- a/packages/flutter_sprites/lib/src/physics_body.dart
+++ b/packages/flutter_sprites/lib/src/physics_body.dart
@@ -35,8 +35,8 @@
     bool bullet: false,
     bool active: true,
     this.gravityScale: 1.0,
-    collisionCategory: "Default",
-    collisionMask: null
+    String collisionCategory: "Default",
+    List<Object> collisionMask
   }) {
     this.density = density;
     this.friction = friction;
diff --git a/packages/flutter_sprites/lib/src/physics_world.dart b/packages/flutter_sprites/lib/src/physics_world.dart
index f975fac..df974e9 100644
--- a/packages/flutter_sprites/lib/src/physics_world.dart
+++ b/packages/flutter_sprites/lib/src/physics_world.dart
@@ -314,7 +314,7 @@
   final PhysicsShape shapeB;
 
   /// True if the two nodes are touching.
-  final isTouching;
+  final bool isTouching;
 
   /// To ignore the collision to take place, you can set isEnabled to false
   /// during the preSolve phase.
diff --git a/packages/flutter_sprites/lib/src/sprite_box.dart b/packages/flutter_sprites/lib/src/sprite_box.dart
index bbff60b..8595d80 100644
--- a/packages/flutter_sprites/lib/src/sprite_box.dart
+++ b/packages/flutter_sprites/lib/src/sprite_box.dart
@@ -164,7 +164,7 @@
   // Event handling
 
   void _addEventTargets(Node node, List<Node> eventTargets) {
-    List children = node.children;
+    List<Node> children = node.children;
     int i = 0;
 
     // Add childrens that are behind this node
diff --git a/packages/flutter_sprites/lib/src/spritesheet.dart b/packages/flutter_sprites/lib/src/spritesheet.dart
index a428502..638c4a6 100644
--- a/packages/flutter_sprites/lib/src/spritesheet.dart
+++ b/packages/flutter_sprites/lib/src/spritesheet.dart
@@ -19,12 +19,12 @@
     assert(jsonDefinition != null);
 
     JsonDecoder decoder = new JsonDecoder();
-    Map file = decoder.convert(jsonDefinition);
+    Map<dynamic, dynamic> file = decoder.convert(jsonDefinition);
     assert(file != null);
 
-    List frames = file["frames"];
+    List<dynamic> frames = file["frames"];
 
-    for (Map frameInfo in frames) {
+    for (Map<dynamic, dynamic> frameInfo in frames) {
       String fileName = frameInfo["filename"];
       Rect frame = _readJsonRect(frameInfo["frame"]);
       bool rotated = frameInfo["rotated"];
@@ -33,13 +33,13 @@
       Size sourceSize = _readJsonSize(frameInfo["sourceSize"]);
       Point pivot = _readJsonPoint(frameInfo["pivot"]);
 
-      var texture = new Texture._fromSpriteFrame(_image, fileName, sourceSize, rotated, trimmed, frame,
+      Texture texture = new Texture._fromSpriteFrame(_image, fileName, sourceSize, rotated, trimmed, frame,
         spriteSourceSize, pivot);
       _textures[fileName] = texture;
     }
   }
 
-  Rect _readJsonRect(Map data) {
+  Rect _readJsonRect(Map<dynamic, dynamic> data) {
     num x = data["x"];
     num y = data["y"];
     num w = data["w"];
@@ -48,14 +48,14 @@
     return new Rect.fromLTRB(x.toDouble(), y.toDouble(), (x + w).toDouble(), (y + h).toDouble());
   }
 
-  Size _readJsonSize(Map data) {
+  Size _readJsonSize(Map<dynamic, dynamic> data) {
     num w = data["w"];
     num h = data["h"];
 
     return new Size(w.toDouble(), h.toDouble());
   }
 
-  Point _readJsonPoint(Map data) {
+  Point _readJsonPoint(Map<dynamic, dynamic> data) {
     num x = data["x"];
     num y = data["y"];
 
diff --git a/packages/flutter_sprites/lib/src/virtual_joystick.dart b/packages/flutter_sprites/lib/src/virtual_joystick.dart
index a9cbc97..d4a2695 100644
--- a/packages/flutter_sprites/lib/src/virtual_joystick.dart
+++ b/packages/flutter_sprites/lib/src/virtual_joystick.dart
@@ -39,7 +39,7 @@
     else if (event.type == PointerUpEvent || event.type == PointerCancelEvent) {
       _pointerDownAt = null;
       _value = Point.origin;
-      ActionTween moveToCenter = new ActionTween((a) => _handlePos = a, _handlePos, _center, 0.4, Curves.elasticOut);
+      ActionTween moveToCenter = new ActionTween((Point a) => _handlePos = a, _handlePos, _center, 0.4, Curves.elasticOut);
       actions.run(moveToCenter);
       _isDown = false;
     } else if (event.type == PointerMoveEvent) {
diff --git a/packages/flutter_test/lib/src/instrumentation.dart b/packages/flutter_test/lib/src/instrumentation.dart
index 24f3909..f415545 100644
--- a/packages/flutter_test/lib/src/instrumentation.dart
+++ b/packages/flutter_test/lib/src/instrumentation.dart
@@ -72,7 +72,10 @@
   /// element.
   Element findText(String text) {
     return findElement((Element element) {
-      return element.widget is Text && element.widget.data == text;
+      if (element.widget is! Text)
+        return false;
+      Text textWidget = element.widget;
+      return textWidget.data == text;
     });
   }
 
diff --git a/packages/flutter_tools/lib/executable.dart b/packages/flutter_tools/lib/executable.dart
index 7ed6a6d..c7959ea 100644
--- a/packages/flutter_tools/lib/executable.dart
+++ b/packages/flutter_tools/lib/executable.dart
@@ -37,7 +37,7 @@
 /// Main entry point for commands.
 ///
 /// This function is intended to be used from the [flutter] command line tool.
-Future main(List<String> args) async {
+Future<Null> main(List<String> args) async {
   bool help = args.contains('-h') || args.contains('--help');
   bool verbose = args.contains('-v') || args.contains('--verbose');
   bool verboseHelp = help && verbose;
@@ -73,7 +73,7 @@
 
     if (result is int)
       exit(result);
-  }, onError: (error, Chain chain) {
+  }, onError: (dynamic error, Chain chain) {
     if (error is UsageException) {
       stderr.writeln(error);
       // Argument error exit code.
diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart
index 1fd9739..2060246 100644
--- a/packages/flutter_tools/lib/src/commands/analyze.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze.dart
@@ -336,6 +336,7 @@
 
     RegExp generalPattern = new RegExp(r'^\[(error|warning|hint|lint)\] (.+) \(([^(),]+), line ([0-9]+), col ([0-9]+)\)$');
     RegExp allowedIdentifiersPattern = new RegExp(r'_?([A-Z]|_+)\b');
+    RegExp classesWithOptionalTypeArgumentsPattern = new RegExp(r'\b(GlobalKey|State|ScrollableState|Element|StatelessComponentElement|TypeMatcher)\b');
     RegExp constructorTearOffsPattern = new RegExp('.+#.+// analyzer doesn\'t like constructor tear-offs');
     RegExp conflictingNamesPattern = new RegExp('^The imported libraries \'([^\']+)\' and \'([^\']+)\' cannot have the same name \'([^\']+)\'\$');
     RegExp missingFilePattern = new RegExp('^Target of URI does not exist: \'([^\')]+)\'\$');
@@ -388,6 +389,11 @@
           } else if (level == 'lint' && errorMessage == 'Name non-constant identifiers using lowerCamelCase.') {
             if (allowedIdentifiersPattern.matchAsPrefix(sourceLine, colNumber-1) != null)
               shouldIgnore = true;
+          } else if (level == 'lint' && errorMessage == 'Specify type annotations.') {
+            // we want the type annotations on certain classes to be optional.
+            // see https://github.com/dart-lang/linter/issues/196
+            if (classesWithOptionalTypeArgumentsPattern.matchAsPrefix(sourceLine, colNumber-1) != null)
+              shouldIgnore = true;
           } else if (constructorTearOffsPattern.allMatches(sourceLine).isNotEmpty) {
             shouldIgnore = true;
           }
diff --git a/packages/newton/test/newton_test.dart b/packages/newton/test/newton_test.dart
index 20efa21..cacc584 100644
--- a/packages/newton/test/newton_test.dart
+++ b/packages/newton/test/newton_test.dart
@@ -10,7 +10,7 @@
 
 void main() {
   test('test_friction', () {
-    var friction = new FrictionSimulation(0.3, 100.0, 400.0);
+    FrictionSimulation friction = new FrictionSimulation(0.3, 100.0, 400.0);
 
     friction.tolerance = const Tolerance(velocity: 1.0);
 
@@ -32,18 +32,18 @@
   test('test_friction_through', () {
     // Use a normal FrictionSimulation to generate start and end
     // velocity and positions with drag = 0.025.
-    var startPosition = 10.0;
-    var startVelocity = 600.0;
-    var f = new FrictionSimulation(0.025, startPosition, startVelocity);
-    var endPosition = f.x(1.0);
-    var endVelocity = f.dx(1.0);
+    double startPosition = 10.0;
+    double startVelocity = 600.0;
+    FrictionSimulation f = new FrictionSimulation(0.025, startPosition, startVelocity);
+    double endPosition = f.x(1.0);
+    double endVelocity = f.dx(1.0);
     expect(endPosition, greaterThan(startPosition));
     expect(endVelocity, lessThan(startVelocity));
 
     // Verify that that the "through" FrictionSimulation ends up at
     // endPosition and endVelocity; implies that it computed the right
     // value for _drag.
-    var friction = new FrictionSimulation.through(
+    FrictionSimulation friction = new FrictionSimulation.through(
         startPosition, endPosition, startVelocity, endVelocity);
     expect(friction.isDone(0.0), false);
     expect(friction.x(0.0), 10.0);
@@ -72,7 +72,7 @@
   });
 
   test('test_gravity', () {
-    var gravity = new GravitySimulation(200.0, 100.0, 600.0, 0.0);
+    GravitySimulation gravity = new GravitySimulation(200.0, 100.0, 600.0, 0.0);
 
     expect(gravity.isDone(0.0), false);
     expect(gravity.x(0.0), 100.0);
@@ -102,7 +102,7 @@
   });
 
   test('spring_types', () {
-    var crit = new SpringSimulation(new SpringDescription.withDampingRatio(
+    SpringSimulation crit = new SpringSimulation(new SpringDescription.withDampingRatio(
         mass: 1.0, springConstant: 100.0), 0.0, 300.0, 0.0);
     expect(crit.type, SpringType.criticallyDamped);
 
@@ -110,23 +110,23 @@
         mass: 1.0, springConstant: 100.0, ratio: 1.0), 0.0, 300.0, 0.0);
     expect(crit.type, SpringType.criticallyDamped);
 
-    var under = new SpringSimulation(new SpringDescription.withDampingRatio(
+    SpringSimulation under = new SpringSimulation(new SpringDescription.withDampingRatio(
         mass: 1.0, springConstant: 100.0, ratio: 0.75), 0.0, 300.0, 0.0);
     expect(under.type, SpringType.underDamped);
 
-    var over = new SpringSimulation(new SpringDescription.withDampingRatio(
+    SpringSimulation over = new SpringSimulation(new SpringDescription.withDampingRatio(
         mass: 1.0, springConstant: 100.0, ratio: 1.25), 0.0, 300.0, 0.0);
     expect(over.type, SpringType.overDamped);
 
     // Just so we don't forget how to create a desc without the ratio.
-    var other = new SpringSimulation(
+    SpringSimulation other = new SpringSimulation(
         new SpringDescription(mass: 1.0, springConstant: 100.0, damping: 20.0),
         0.0, 20.0, 20.0);
     expect(other.type, SpringType.criticallyDamped);
   });
 
   test('crit_spring', () {
-    var crit = new SpringSimulation(new SpringDescription.withDampingRatio(
+    SpringSimulation crit = new SpringSimulation(new SpringDescription.withDampingRatio(
         mass: 1.0, springConstant: 100.0, ratio: 1.0), 0.0, 500.0, 0.0);
 
     crit.tolerance = const Tolerance(distance: 0.01, velocity: 0.01);
@@ -151,7 +151,7 @@
   });
 
   test('overdamped_spring', () {
-    var over = new SpringSimulation(new SpringDescription.withDampingRatio(
+    SpringSimulation over = new SpringSimulation(new SpringDescription.withDampingRatio(
         mass: 1.0, springConstant: 100.0, ratio: 1.25), 0.0, 500.0, 0.0);
 
     over.tolerance = const Tolerance(distance: 0.01, velocity: 0.01);
@@ -173,7 +173,7 @@
   });
 
   test('underdamped_spring', () {
-    var under = new SpringSimulation(new SpringDescription.withDampingRatio(
+    SpringSimulation under = new SpringSimulation(new SpringDescription.withDampingRatio(
         mass: 1.0, springConstant: 100.0, ratio: 0.25), 0.0, 300.0, 0.0);
     expect(under.type, SpringType.underDamped);
 
@@ -190,16 +190,16 @@
   });
 
   test('test_kinetic_scroll', () {
-    var spring = new SpringDescription.withDampingRatio(
+    SpringDescription spring = new SpringDescription.withDampingRatio(
         mass: 1.0, springConstant: 50.0, ratio: 0.5);
 
-    var scroll = new ScrollSimulation(100.0, 800.0, 0.0, 300.0, spring, 0.3);
+    ScrollSimulation scroll = new ScrollSimulation(100.0, 800.0, 0.0, 300.0, spring, 0.3);
     scroll.tolerance = const Tolerance(velocity: 0.5, distance: 0.1);
     expect(scroll.isDone(0.0), false);
     expect(scroll.isDone(0.5), false); // switch from friction to spring
     expect(scroll.isDone(3.5), true);
 
-    var scroll2 = new ScrollSimulation(100.0, -800.0, 0.0, 300.0, spring, 0.3);
+    ScrollSimulation scroll2 = new ScrollSimulation(100.0, -800.0, 0.0, 300.0, spring, 0.3);
     scroll2.tolerance = const Tolerance(velocity: 0.5, distance: 0.1);
     expect(scroll2.isDone(0.0), false);
     expect(scroll2.isDone(0.5), false); // switch from friction to spring
@@ -207,10 +207,10 @@
   });
 
   test('scroll_with_inf_edge_ends', () {
-    var spring = new SpringDescription.withDampingRatio(
+    SpringDescription spring = new SpringDescription.withDampingRatio(
         mass: 1.0, springConstant: 50.0, ratio: 0.5);
 
-    var scroll =
+    ScrollSimulation scroll =
         new ScrollSimulation(100.0, 400.0, 0.0, double.INFINITY, spring, 0.3);
     scroll.tolerance = const Tolerance(velocity: 1.0);
 
@@ -233,8 +233,8 @@
   });
 
   test('over/under scroll spring', () {
-    var spring = new SpringDescription.withDampingRatio(mass: 1.0, springConstant: 170.0, ratio: 1.1);
-    var scroll = new ScrollSimulation(500.0, -7500.0, 0.0, 1000.0, spring, 0.025);
+    SpringDescription spring = new SpringDescription.withDampingRatio(mass: 1.0, springConstant: 170.0, ratio: 1.1);
+    ScrollSimulation scroll = new ScrollSimulation(500.0, -7500.0, 0.0, 1000.0, spring, 0.025);
     scroll.tolerance = new Tolerance(velocity: 45.0, distance: 1.5);
 
     expect(scroll.isDone(0.0), false);
