• Vyacheslav Egorov's avatar
    Strong mode fixes in tests (#14520) · 0556e14f
    Vyacheslav Egorov authored
    * Use explicit types for onClick handler in diagnostics_test.
    
    This test formats it to string and expects exact match.
    
    Before this change onClick had type () => dynamic in Dart 1 and () => Null in
    Dart 2.
    
    * Fix strong mode issues in packages/flutter/test/material/dropdown_test.dart
    
    Pass explicit type argument to renderObjectList(...) in expressions like
    
         List<RenderBox> l = tester.renderObjectList(...).toList();
    
    Dart 2 mode inference is not strong enough to infer RenderBox as a type argument
    fto renderObjectList and passes RenderObject instead, which later leads to
    runtime check failures (because List<RenderObject> is not List<RenderBox>).
    
    * Fix strong mode issues in packages/flutter/test/material/theme_test.dart.
    
    Pass type argument explicity to widgetList. Dart 2 type inference can't infer
    it by itself.
    
    * Fix strong mode issue packages/flutter/test/widgets/unique_widget_test.dart
    
    Pass correct type argument to GlobalKey.
    
    * Fix type annotation in packages/flutter/test/material/app_test.dart.
    
    pushNamed returns Future<Object> not Future<String>.
    0556e14f
app_test.dart 10.7 KB