Enable avoid_as lint (#3612)

Related to #3608
This commit is contained in:
Adam Barth 2016-04-28 11:07:39 -07:00
parent 26ed1e71f9
commit b7fd5426b5
3 changed files with 7 additions and 4 deletions

View file

@ -118,8 +118,10 @@ class WidgetTester {
Element element = finder.findFirst(this);
Widget widget = element.widget;
if (widget is StatefulWidget)
return (element as StatefulElement).state;
if (widget is StatefulWidget) {
StatefulElement statefulElement = element;
return statefulElement.state;
}
throw new ElementNotFoundError(
'Widget of type ${widget.runtimeType} found by ${finder.description} does not correspond to a StatefulWidget'

View file

@ -29,7 +29,7 @@ linter:
- always_declare_return_types
- always_specify_types
- annotate_overrides
# - avoid_as # https://github.com/dart-lang/linter/issues/195
- avoid_as
- avoid_init_to_null
# - avoid_return_types_on_setters # https://github.com/dart-lang/linter/issues/202
- camel_case_types

View file

@ -143,7 +143,8 @@ class Cache {
os.unzip(tempFile, location);
tempFile.deleteSync();
} else {
(location as File).writeAsBytesSync(fileBytes, flush: true);
File file = location;
file.writeAsBytesSync(fileBytes, flush: true);
}
}
}