Commit 1fce14a3 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

enable lint prefer_single_quotes (#12665)

parent b07ea419
......@@ -125,7 +125,7 @@ linter:
# - prefer_interpolation_to_compose_strings # not yet tested
- prefer_is_empty
- prefer_is_not_empty
# - prefer_single_quote_strings # not yet tested
- prefer_single_quotes
# - public_member_api_docs # this is the only difference from analysis_options_repo.yaml
- recursive_getters
- slash_for_doc_comments
......
......@@ -119,7 +119,7 @@ linter:
# - prefer_interpolation_to_compose_strings # not yet tested
- prefer_is_empty
- prefer_is_not_empty
# - prefer_single_quote_strings # not yet tested
- prefer_single_quotes
- public_member_api_docs # this is the only difference from analysis_options_repo.yaml
- recursive_getters
- slash_for_doc_comments
......
......@@ -9,6 +9,6 @@ void main() {
expect(2 + 2, 4);
});
test('excluded', () {
throw "this test should have been filtered out";
throw 'this test should have been filtered out';
});
}
......@@ -31,7 +31,7 @@ void main() {
expect(await driver.setSemantics(true), isTrue);
});
final Iterable<TimelineEvent> semanticsEvents = timeline.events.where((TimelineEvent event) => event.name == "Semantics");
final Iterable<TimelineEvent> semanticsEvents = timeline.events.where((TimelineEvent event) => event.name == 'Semantics');
if (semanticsEvents.length != 1)
fail('Expected exactly one semantics event, got ${semanticsEvents.length}');
final Duration semanticsTreeCreation = semanticsEvents.first.duration;
......
......@@ -29,7 +29,7 @@ class CardCollectionState extends State<CardCollection> {
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
// TODO(hansmuller): need a local image asset
static const String _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 double kCardMargins = 8.0;
static const double kFixedCardHeight = 100.0;
......@@ -103,23 +103,23 @@ class CardCollectionState extends State<CardCollection> {
child: new ListView(
children: <Widget>[
const DrawerHeader(child: const Center(child: const Text('Options'))),
buildDrawerCheckbox("Make card labels editable", _editable, _toggleEditable),
buildDrawerCheckbox("Fixed size cards", _fixedSizeCards, _toggleFixedSizeCards),
buildDrawerCheckbox("Let the sun shine", _sunshine, _toggleSunshine),
buildDrawerCheckbox("Vary font sizes", _varyFontSizes, _toggleVaryFontSizes, enabled: !_editable),
buildDrawerCheckbox('Make card labels editable', _editable, _toggleEditable),
buildDrawerCheckbox('Fixed size cards', _fixedSizeCards, _toggleFixedSizeCards),
buildDrawerCheckbox('Let the sun shine', _sunshine, _toggleSunshine),
buildDrawerCheckbox('Vary font sizes', _varyFontSizes, _toggleVaryFontSizes, enabled: !_editable),
const Divider(),
buildDrawerColorRadioItem("Deep Purple", Colors.deepPurple, _primaryColor, _selectColor),
buildDrawerColorRadioItem("Green", Colors.green, _primaryColor, _selectColor),
buildDrawerColorRadioItem("Amber", Colors.amber, _primaryColor, _selectColor),
buildDrawerColorRadioItem("Teal", Colors.teal, _primaryColor, _selectColor),
buildDrawerColorRadioItem('Deep Purple', Colors.deepPurple, _primaryColor, _selectColor),
buildDrawerColorRadioItem('Green', Colors.green, _primaryColor, _selectColor),
buildDrawerColorRadioItem('Amber', Colors.amber, _primaryColor, _selectColor),
buildDrawerColorRadioItem('Teal', Colors.teal, _primaryColor, _selectColor),
const Divider(),
buildDrawerDirectionRadioItem("Dismiss horizontally", DismissDirection.horizontal, _dismissDirection, _changeDismissDirection, icon: Icons.code),
buildDrawerDirectionRadioItem("Dismiss left", DismissDirection.endToStart, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_back),
buildDrawerDirectionRadioItem("Dismiss right", DismissDirection.startToEnd, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_forward),
buildDrawerDirectionRadioItem('Dismiss horizontally', DismissDirection.horizontal, _dismissDirection, _changeDismissDirection, icon: Icons.code),
buildDrawerDirectionRadioItem('Dismiss left', DismissDirection.endToStart, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_back),
buildDrawerDirectionRadioItem('Dismiss right', DismissDirection.startToEnd, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_forward),
const Divider(),
buildFontRadioItem("Left-align text", TextAlign.left, _textAlign, _changeTextAlign, icon: Icons.format_align_left, enabled: !_editable),
buildFontRadioItem("Center-align text", TextAlign.center, _textAlign, _changeTextAlign, icon: Icons.format_align_center, enabled: !_editable),
buildFontRadioItem("Right-align text", TextAlign.right, _textAlign, _changeTextAlign, icon: Icons.format_align_right, enabled: !_editable),
buildFontRadioItem('Left-align text', TextAlign.left, _textAlign, _changeTextAlign, icon: Icons.format_align_left, enabled: !_editable),
buildFontRadioItem('Center-align text', TextAlign.center, _textAlign, _changeTextAlign, icon: Icons.format_align_center, enabled: !_editable),
buildFontRadioItem('Right-align text', TextAlign.right, _textAlign, _changeTextAlign, icon: Icons.format_align_right, enabled: !_editable),
const Divider(),
new ListTile(
leading: const Icon(Icons.dvr),
......@@ -282,16 +282,16 @@ class CardCollectionState extends State<CardCollection> {
String backgroundMessage;
switch (_dismissDirection) {
case DismissDirection.horizontal:
backgroundMessage = "Swipe in either direction";
backgroundMessage = 'Swipe in either direction';
break;
case DismissDirection.endToStart:
backgroundMessage = "Swipe left to dismiss";
backgroundMessage = 'Swipe left to dismiss';
break;
case DismissDirection.startToEnd:
backgroundMessage = "Swipe right to dismiss";
backgroundMessage = 'Swipe right to dismiss';
break;
default:
backgroundMessage = "Unsupported dismissDirection";
backgroundMessage = 'Unsupported dismissDirection';
}
// TODO(abarth): This icon is wrong in RTL.
......
......@@ -211,7 +211,7 @@ class _PointDemoState extends State<_PointDemo> {
child: new Padding(
padding: const EdgeInsets.all(16.0),
child: new Text(
"Tap the refresh button to run the animation. Drag the green "
'Tap the refresh button to run the animation. Drag the green '
"and red points to change the animation's path.",
style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0)
)
......@@ -384,7 +384,7 @@ class _RectangleDemoState extends State<_RectangleDemo> {
child: new Padding(
padding: const EdgeInsets.all(16.0),
child: new Text(
"Tap the refresh button to run the animation. Drag the rectangles "
'Tap the refresh button to run the animation. Drag the rectangles '
"to change the animation's path.",
style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0)
)
......
......@@ -112,7 +112,7 @@ class PageViewAppState extends State<PageViewApp> {
return new AppBar(
title: const Text('PageView'),
actions: <Widget>[
new Text(scrollDirection == Axis.horizontal ? "horizontal" : "vertical"),
new Text(scrollDirection == Axis.horizontal ? 'horizontal' : 'vertical'),
],
);
}
......
......@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../lib/card_collection.dart' as card_collection;
void main() {
testWidgets("Card Collection smoke test", (WidgetTester tester) async {
testWidgets('Card Collection smoke test', (WidgetTester tester) async {
card_collection.main(); // builds the app and schedules a frame but doesn't trigger one
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame
......
......@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../lib/color_testing_demo.dart' as color_testing_demo;
void main() {
testWidgets("Color testing demo smoke test", (WidgetTester tester) async {
testWidgets('Color testing demo smoke test', (WidgetTester tester) async {
color_testing_demo.main(); // builds the app and schedules a frame but doesn't trigger one
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame
......
......@@ -42,34 +42,35 @@ const String outputHeader = '''
final Map<String, Map<String, String>> localeToResources = <String, Map<String, String>>{};
/// Maps locales to resource attributes.
///
///
/// See also https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#resource-attributes
final Map<String, Map<String, dynamic>> localeToResourceAttributes = <String, Map<String, dynamic>>{};
// Return s as a Dart-parseable raw string in double quotes. Expand double quotes:
// foo => r"foo"
// foo "bar" => r"foo " '"' r"bar" '"'
// Return s as a Dart-parseable raw string in single or double quotes. Expand double quotes:
// foo => r'foo'
// foo "bar" => r'foo "bar"'
// foo 'bar' => r'foo ' "'" r'bar' "'"
String generateString(String s) {
if (!s.contains('"'))
return 'r"$s"';
if (!s.contains("'"))
return "r'$s'";
final StringBuffer output = new StringBuffer();
bool started = false; // Have we started writing a raw string.
for (int i = 0; i < s.length; i++) {
if (s[i] == '"') {
if (s[i] == "'") {
if (started)
output.write('"');
output.write(' \'"\' ');
output.write("'");
output.write(' "\'" ');
started = false;
} else if (!started) {
output.write('r"${s[i]}');
output.write("r'${s[i]}");
started = true;
} else {
output.write(s[i]);
}
}
if (started)
output.write('"');
output.write("'");
return output.toString();
}
......@@ -84,12 +85,12 @@ String generateLocalizationsMap() {
const Map<String, Map<String, String>> localizations = const <String, Map<String, String>> {''');
for (String locale in localeToResources.keys.toList()..sort()) {
output.writeln(' "$locale": const <String, String>{');
output.writeln(" '$locale': const <String, String>{");
final Map<String, String> resources = localeToResources[locale];
for (String name in resources.keys) {
final String value = generateString(resources[name]);
output.writeln(' "$name": $value,');
output.writeln(" '$name': $value,");
}
output.writeln(' },');
}
......
......@@ -91,7 +91,7 @@ void _createEntry(File mainFile, int copies) {
for (int i = 1; i < copies; i++) {
imports.writeln("import 'gallery_$i/main.dart' as main_$i;");
importRefs.writeln(" main_$i.main;");
importRefs.writeln(' main_$i.main;');
}
final String contents = '''
......
......@@ -57,7 +57,7 @@ String expandTemplate(String template, Map<String, String> values) {
if (match.groupCount != 1)
throw new SampleError('bad template keyword $match[0]');
final String keyword = match[1];
return (values[keyword] ?? "");
return (values[keyword] ?? '');
});
}
......
......@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../lib/animated_list.dart' as animated_list_sample;
void main() {
testWidgets("animated_list sample app smoke test", (WidgetTester tester) async {
testWidgets('animated_list sample app smoke test', (WidgetTester tester) async {
animated_list_sample.main();
await tester.pump();
......
......@@ -20,7 +20,7 @@ Finder findChoiceCard(IconData icon) {
}
void main() {
testWidgets("basic_app_bar sample smoke test", (WidgetTester tester) async {
testWidgets('basic_app_bar sample smoke test', (WidgetTester tester) async {
basic_app_bar_sample.main();
await tester.pump();
......
......@@ -9,7 +9,7 @@ import '../lib/expansion_tile_sample.dart' as expansion_tile_sample;
import '../lib/expansion_tile_sample.dart' show Entry;
void main() {
testWidgets("expansion_tile sample smoke test", (WidgetTester tester) async {
testWidgets('expansion_tile sample smoke test', (WidgetTester tester) async {
expansion_tile_sample.main();
await tester.pump();
......
......@@ -19,7 +19,7 @@ Finder findTab(IconData icon) {
}
void main() {
testWidgets("tabbed_app_bar sample smoke test", (WidgetTester tester) async {
testWidgets('tabbed_app_bar sample smoke test', (WidgetTester tester) async {
tabbed_app_bar_sample.main();
await tester.pump();
......
......@@ -13,11 +13,11 @@ enum DialogDemoAction {
agree,
}
const String _alertWithoutTitleText = "Discard draft?";
const String _alertWithoutTitleText = 'Discard draft?';
const String _alertWithTitleText =
"Let Google help apps determine location. This means sending anyonmous location "
"data to Google, even when no apps are running.";
'Let Google help apps determine location. This means sending anyonmous location '
'data to Google, even when no apps are running.';
class DialogDemoItem extends StatelessWidget {
const DialogDemoItem({ Key key, this.icon, this.color, this.text, this.onPressed }) : super(key: key);
......
......@@ -225,7 +225,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
name: 'Location',
value: _Location.Bahamas,
hint: 'Select location',
valueToString: (_Location location) => location.toString().split(".")[1],
valueToString: (_Location location) => location.toString().split('.')[1],
builder: (DemoItem<_Location> item) {
void close() {
setState(() {
......
......@@ -172,10 +172,10 @@ class _ListDemoState extends State<ListDemo> {
Widget buildListTile(BuildContext context, String item) {
Widget secondary;
if (_itemType == _MaterialListType.twoLine) {
secondary = const Text("Additional item information.");
secondary = const Text('Additional item information.');
} else if (_itemType == _MaterialListType.threeLine) {
secondary = const Text(
"Even more additional list item information appears on line three.",
'Even more additional list item information appears on line three.',
);
}
return new MergeSemantics(
......@@ -192,7 +192,7 @@ class _ListDemoState extends State<ListDemo> {
@override
Widget build(BuildContext context) {
final String layoutText = _dense ? " \u2013 Dense" : "";
final String layoutText = _dense ? ' \u2013 Dense' : '';
String itemTypeText;
switch (_itemType) {
case _MaterialListType.oneLine:
......
......@@ -29,7 +29,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
new Timer(const Duration(seconds: 3), () { completer.complete(null); });
return completer.future.then((_) {
_scaffoldKey.currentState?.showSnackBar(new SnackBar(
content: const Text("Refresh complete"),
content: const Text('Refresh complete'),
action: new SnackBarAction(
label: 'RETRY',
onPressed: () {
......
......@@ -7,21 +7,21 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
const String _checkboxText =
"Checkboxes allow the user to select multiple options from a set.";
'Checkboxes allow the user to select multiple options from a set.';
const String _checkboxCode = 'selectioncontrols_checkbox';
const String _radioText =
"Radio buttons allow the user to select one option from a set. Use radio "
"buttons for exclusive selection if you think that the user needs to see "
"all available options side-by-side.";
'Radio buttons allow the user to select one option from a set. Use radio '
'buttons for exclusive selection if you think that the user needs to see '
'all available options side-by-side.';
const String _radioCode = 'selectioncontrols_radio';
const String _switchText =
"On/off switches toggle the state of a single settings option. The option "
"that the switch controls, as well as the state it’s in, should be made "
"clear from the corresponding inline label.";
'On/off switches toggle the state of a single settings option. The option '
'that the switch controls, as well as the state it’s in, should be made '
'clear from the corresponding inline label.';
const String _switchCode = 'selectioncontrols_switch';
......@@ -37,19 +37,19 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget build(BuildContext context) {
final List<ComponentDemoTabData> demos = <ComponentDemoTabData>[
new ComponentDemoTabData(
tabName: "CHECKBOX",
tabName: 'CHECKBOX',
description: _checkboxText,
demoWidget: buildCheckbox(),
exampleCodeTag: _checkboxCode
),
new ComponentDemoTabData(
tabName: "RADIO",
tabName: 'RADIO',
description: _radioText,
demoWidget: buildRadio(),
exampleCodeTag: _radioCode
),
new ComponentDemoTabData(
tabName: "SWITCH",
tabName: 'SWITCH',
description: _switchText,
demoWidget: buildSwitch(),
exampleCodeTag: _switchCode
......
......@@ -5,16 +5,16 @@
import 'package:flutter/material.dart';
const String _text1 =
"Snackbars provide lightweight feedback about an operation by "
"showing a brief message at the bottom of the screen. Snackbars "
"can contain an action.";
'Snackbars provide lightweight feedback about an operation by '
'showing a brief message at the bottom of the screen. Snackbars '
'can contain an action.';
const String _text2 =
"Snackbars should contain a single line of text directly related "
"to the operation performed. They cannot contain icons.";
'Snackbars should contain a single line of text directly related '
'to the operation performed. They cannot contain icons.';
const String _text3 =
"By default snackbars automatically disappear after a few seconds ";
'By default snackbars automatically disappear after a few seconds ';
class SnackBarDemo extends StatefulWidget {
const SnackBarDemo({ Key key }) : super(key: key);
......
......@@ -6,9 +6,9 @@ import 'package:flutter/material.dart';
const String _explanatoryText =
"When the Scaffold's floating action button changes, the new button fades and "
"turns into view. In this demo, changing tabs can cause the app to be rebuilt "
"with a FloatingActionButton that the Scaffold distinguishes from the others "
"by its key.";
'turns into view. In this demo, changing tabs can cause the app to be rebuilt '
'with a FloatingActionButton that the Scaffold distinguishes from the others '
'by its key.';
class _Page {
_Page({ this.label, this.colors, this.icon });
......
......@@ -5,9 +5,9 @@
import 'package:flutter/material.dart';
const String _introText =
"Tooltips are short identifying messages that briefly appear in response to "
"a long press. Tooltip messages are also used by services that make Flutter "
"apps accessible, like screen readers.";
'Tooltips are short identifying messages that briefly appear in response to '
'a long press. Tooltip messages are also used by services that make Flutter '
'apps accessible, like screen readers.';
class TooltipDemo extends StatelessWidget {
......
......@@ -162,14 +162,14 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
void showFavoritesPage(BuildContext context) {
Navigator.push(context, new MaterialPageRoute<Null>(
settings: const RouteSettings(name: "/pesto/favorites"),
settings: const RouteSettings(name: '/pesto/favorites'),
builder: (BuildContext context) => new PestoFavorites(),
));
}
void showRecipePage(BuildContext context, Recipe recipe) {
Navigator.push(context, new MaterialPageRoute<Null>(
settings: const RouteSettings(name: "/pesto/recipe"),
settings: const RouteSettings(name: '/pesto/recipe'),
builder: (BuildContext context) {
return new Theme(
data: _kTheme.copyWith(platform: Theme.of(context).platform),
......
......@@ -118,10 +118,10 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
while (!_scanner.isDone) {
// Skip White space
_scanner.scan(new RegExp(r"\s+"));
_scanner.scan(new RegExp(r'\s+'));
// Block comments
if (_scanner.scan(new RegExp(r"/\*(.|\n)*\*/"))) {
if (_scanner.scan(new RegExp(r'/\*(.|\n)*\*/'))) {
_spans.add(new _HighlightSpan(
_HighlightType.comment,
_scanner.lastMatch.start,
......@@ -131,12 +131,12 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
}
// Line comments
if (_scanner.scan("//")) {
if (_scanner.scan('//')) {
final int startComment = _scanner.lastMatch.start;
bool eof = false;
int endComment;
if (_scanner.scan(new RegExp(r".*\n"))) {
if (_scanner.scan(new RegExp(r'.*\n'))) {
endComment = _scanner.lastMatch.end - 1;
} else {
eof = true;
......@@ -216,7 +216,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
}
// Double
if (_scanner.scan(new RegExp(r"\d+\.\d+"))) {
if (_scanner.scan(new RegExp(r'\d+\.\d+'))) {
_spans.add(new _HighlightSpan(
_HighlightType.number,
_scanner.lastMatch.start,
......@@ -226,7 +226,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
}
// Integer
if (_scanner.scan(new RegExp(r"\d+"))) {
if (_scanner.scan(new RegExp(r'\d+'))) {
_spans.add(new _HighlightSpan(
_HighlightType.number,
_scanner.lastMatch.start,
......@@ -236,7 +236,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
}
// Punctuation
if (_scanner.scan(new RegExp(r"[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]"))) {
if (_scanner.scan(new RegExp(r'[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]'))) {
_spans.add(new _HighlightSpan(
_HighlightType.punctuation,
_scanner.lastMatch.start,
......@@ -246,7 +246,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
}
// Meta data
if (_scanner.scan(new RegExp(r"@\w+"))) {
if (_scanner.scan(new RegExp(r'@\w+'))) {
_spans.add(new _HighlightSpan(
_HighlightType.keyword,
_scanner.lastMatch.start,
......@@ -256,11 +256,11 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
}
// Words
if (_scanner.scan(new RegExp(r"\w+"))) {
if (_scanner.scan(new RegExp(r'\w+'))) {
_HighlightType type;
String word = _scanner.lastMatch[0];
if (word.startsWith("_"))
if (word.startsWith('_'))
word = word.substring(1);
if (_kKeywords.contains(word))
......@@ -269,7 +269,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
type = _HighlightType.keyword;
else if (_firstLetterIsUpperCase(word))
type = _HighlightType.klass;
else if (word.length >= 2 && word.startsWith("k") && _firstLetterIsUpperCase(word.substring(1)))
else if (word.length >= 2 && word.startsWith('k') && _firstLetterIsUpperCase(word.substring(1)))
type = _HighlightType.constant;
if (type != null) {
......
......@@ -16,7 +16,7 @@ void main() {
expression = expression.appendDigit(4);
expression = expression.computeResult();
expect(expression.state, equals(ExpressionState.Result));
expect(expression.toString(), equals("24"));
expect(expression.toString(), equals('24'));
});
test('Test floating point 0.1 + 0.2 = 0.3', () {
......@@ -30,7 +30,7 @@ void main() {
expression = expression.appendDigit(2);
expression = expression.computeResult();
expect(expression.state, equals(ExpressionState.Result));
expect(expression.toString(), equals("0.3"));
expect(expression.toString(), equals('0.3'));
});
test('Test floating point 1.0/10.0 = 0.1', () {
......@@ -45,7 +45,7 @@ void main() {
expression = expression.appendDigit(0);
expression = expression.computeResult();
expect(expression.state, equals(ExpressionState.Result));
expect(expression.toString(), equals("0.1"));
expect(expression.toString(), equals('0.1'));
});
test('Test 1/0 = Infinity', () {
......@@ -55,7 +55,7 @@ void main() {
expression = expression.appendDigit(0);
expression = expression.computeResult();
expect(expression.state, equals(ExpressionState.Result));
expect(expression.toString(), equals("Infinity"));
expect(expression.toString(), equals('Infinity'));
});
test('Test use result in next calculation: 1 + 1 = 2 + 1 = 3 + 1 = 4', () {
......@@ -71,7 +71,7 @@ void main() {
expression = expression.appendDigit(1);
expression = expression.computeResult();
expect(expression.state, equals(ExpressionState.Result));
expect(expression.toString(), equals("4"));
expect(expression.toString(), equals('4'));
});
test('Test minus -3 - -2 = -1', () {
......@@ -83,6 +83,6 @@ void main() {
expression = expression.appendDigit(2);
expression = expression.computeResult();
expect(expression.state, equals(ExpressionState.Result));
expect(expression.toString(), equals("-1"));
expect(expression.toString(), equals('-1'));
});
}
......@@ -51,21 +51,21 @@ void main() {
expect(app.theme.platform, equals(TargetPlatform.iOS));
// Verify the font scale.
final Size origTextSize = tester.getSize(find.text("Small"));
final Size origTextSize = tester.getSize(find.text('Small'));
expect(origTextSize, equals(const Size(176.0, 14.0)));
// Switch font scale.
await tester.tap(find.text('Small'));
await tester.pump();
await tester.pump(const Duration(seconds: 1)); // Wait until it's changed.
final Size textSize = tester.getSize(find.text("Small"));
final Size textSize = tester.getSize(find.text('Small'));
expect(textSize, equals(const Size(176.0, 11.0)));
// Set font scale back to default.
await tester.tap(find.text('System Default'));
await tester.pump();
await tester.pump(const Duration(seconds: 1)); // Wait until it's changed.
final Size newTextSize = tester.getSize(find.text("Small"));
final Size newTextSize = tester.getSize(find.text('Small'));
expect(newTextSize, equals(origTextSize));
// Scroll to the bottom of the menu.
......
......@@ -21,7 +21,7 @@ void main() {
});
}
const String testCodeFile = """// A fake test file
const String testCodeFile = '''// A fake test file
// START test_0
test 0 0
test 0 1
......@@ -32,7 +32,7 @@ test 0 1
test 1 0
test 1 1
// END
""";
''';
class TestAssetBundle extends AssetBundle {
@override
......
......@@ -26,9 +26,9 @@ class MyHomePage extends StatefulWidget {
}
class _MyHomePageState extends State<MyHomePage> {
static const String _channel = "increment";
static const String _pong = "pong";
static const String _emptyMessage = "";
static const String _channel = 'increment';
static const String _pong = 'pong';
static const String _emptyMessage = '';
static const BasicMessageChannel<String> platform =
const BasicMessageChannel<String>(_channel, const StringCodec());
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../lib/main.dart' as hello_world;
void main() {
testWidgets("Hello world smoke test", (WidgetTester tester) async {
testWidgets('Hello world smoke test', (WidgetTester tester) async {
hello_world.main(); // builds the app and schedules a frame but doesn't trigger one
await tester.pump(); // triggers a frame
......
......@@ -104,7 +104,7 @@ void main() {
final RenderParagraph paragraph = new RenderParagraph(
const TextSpan(
style: const TextStyle(color: Colors.black87),
text: "Touch me!",
text: 'Touch me!',
),
textDirection: TextDirection.ltr,
);
......
......@@ -46,21 +46,21 @@ class Calculator {
try {
final List<dynamic> result = decoder.convert(_data);
final int n = result.length;
onResultListener("Decoded $n results");
onResultListener('Decoded $n results');
} catch (e, stack) {
print("Invalid JSON file: $e");
print('Invalid JSON file: $e');
print(stack);
}
}
static String _replicateJson(String data, int count) {
final StringBuffer buffer = new StringBuffer()..write("[");
final StringBuffer buffer = new StringBuffer()..write('[');
for (int i = 0; i < count; i++) {
buffer.write(data);
if (i < count - 1)
buffer.write(',');
}
buffer.write("]");
buffer.write(']');
return buffer.toString();
}
}
......
......@@ -24,7 +24,7 @@ final List<List<String>> _kNameLines = _kDialogText
.toList();
final TextStyle _kDaveStyle = new TextStyle(color: Colors.indigo.shade400, height: 1.8);
final TextStyle _kHalStyle = new TextStyle(color: Colors.red.shade400, fontFamily: "monospace");
final TextStyle _kHalStyle = new TextStyle(color: Colors.red.shade400, fontFamily: 'monospace');
final TextStyle _kBold = const TextStyle(fontWeight: FontWeight.bold);
final TextStyle _kUnderline = const TextStyle(
decoration: TextDecoration.underline,
......@@ -33,7 +33,7 @@ final TextStyle _kUnderline = const TextStyle(
);
Widget toStyledText(String name, String text) {
final TextStyle lineStyle = (name == "Dave") ? _kDaveStyle : _kHalStyle;
final TextStyle lineStyle = (name == 'Dave') ? _kDaveStyle : _kHalStyle;
return new RichText(
key: new Key(text),
text: new TextSpan(
......@@ -55,7 +55,7 @@ Widget toStyledText(String name, String text) {
);
}
Widget toPlainText(String name, String text) => new Text(name + ":" + text);
Widget toPlainText(String name, String text) => new Text(name + ':' + text);
class SpeakerSeparator extends StatelessWidget {
@override
......
......@@ -27,7 +27,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
final int result = await methodChannel.invokeMethod('getBatteryLevel');
batteryLevel = 'Battery level: $result%.';
} on PlatformException {
batteryLevel = "Failed to get battery level.";
batteryLevel = 'Failed to get battery level.';
}
setState(() {
_batteryLevel = batteryLevel;
......@@ -49,7 +49,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
void _onError(PlatformException error) {
setState(() {
_chargingStatus = "Battery status: unknown.";
_chargingStatus = 'Battery status: unknown.';
});
}
......
......@@ -27,7 +27,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
final int result = await methodChannel.invokeMethod('getBatteryLevel');
batteryLevel = 'Battery level: $result%.';
} on PlatformException {
batteryLevel = "Failed to get battery level.";
batteryLevel = 'Failed to get battery level.';
}
setState(() {
_batteryLevel = batteryLevel;
......@@ -49,7 +49,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
void _onError(PlatformException error) {
setState(() {
_chargingStatus = "Battery status: unknown.";
_chargingStatus = 'Battery status: unknown.';
});
}
......
......@@ -35,7 +35,7 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
static const MethodChannel _methodChannel =
const MethodChannel("samples.flutter.io/platform_view");
const MethodChannel('samples.flutter.io/platform_view');
int _counter = 0;
......@@ -47,7 +47,7 @@ class _MyHomePageState extends State<MyHomePage> {
Future<Null> _launchPlatformCount() async {
final int platformCounter =
await _methodChannel.invokeMethod("switchView", _counter);
await _methodChannel.invokeMethod('switchView', _counter);
setState(() {
_counter = platformCounter;
});
......
......@@ -245,9 +245,9 @@ class StockHomeState extends State<StockHome> {
stock.lastSale += 1.0;
});
_scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text("Purchased ${stock.symbol} for ${stock.lastSale}"),
content: new Text('Purchased ${stock.symbol} for ${stock.lastSale}'),
action: new SnackBarAction(
label: "BUY MORE",
label: 'BUY MORE',
onPressed: () {
_buyStock(stock);
},
......@@ -278,7 +278,7 @@ class StockHomeState extends State<StockHome> {
);
}
static const List<String> portfolioSymbols = const <String>["AAPL","FIZZ", "FIVE", "FLAT", "ZINC", "ZNGA"];
static const List<String> portfolioSymbols = const <String>['AAPL','FIZZ', 'FIVE', 'FLAT', 'ZINC', 'ZNGA'];
Widget buildSearchBar() {
return new AppBar(
......
......@@ -30,10 +30,10 @@ class StockRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
final String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";
String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%";
final String lastSale = '\$${stock.lastSale.toStringAsFixed(2)}';
String changeInPrice = '${stock.percentChange.toStringAsFixed(2)}%';
if (stock.percentChange > 0)
changeInPrice = "+" + changeInPrice;
changeInPrice = '+' + changeInPrice;
return new InkWell(
onTap: _getHandler(onPressed),
onDoubleTap: _getHandler(onDoubleTap),
......
......@@ -68,8 +68,8 @@ class StockSettingsState extends State<StockSettings> {
showDialog<bool>(
context: context,
child: new AlertDialog(
title: const Text("Change mode?"),
content: const Text("Optimistic mode means everything is awesome. Are you sure you can handle that?"),
title: const Text('Change mode?'),
content: const Text('Optimistic mode means everything is awesome. Are you sure you can handle that?'),
actions: <Widget>[
new FlatButton(
child: const Text('NO THANKS'),
......
......@@ -16,10 +16,10 @@ class _StockSymbolView extends StatelessWidget {
@override
Widget build(BuildContext context) {
assert(stock != null);
final String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";
String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%";
final String lastSale = '\$${stock.lastSale.toStringAsFixed(2)}';
String changeInPrice = '${stock.percentChange.toStringAsFixed(2)}%';
if (stock.percentChange > 0)
changeInPrice = "+" + changeInPrice;
changeInPrice = '+' + changeInPrice;
final TextStyle headings = Theme.of(context).textTheme.body2;
return new Container(
......
......@@ -5,7 +5,7 @@
import 'dart:ui';
/// Whether we've been built in release mode.
const bool _kReleaseMode = const bool.fromEnvironment("dart.vm.product");
const bool _kReleaseMode = const bool.fromEnvironment('dart.vm.product');
/// When running in profile mode (or debug mode), invoke the given function.
///
......
......@@ -170,7 +170,7 @@ class HSVColor {
int get hashCode => hashValues(alpha, hue, saturation, value);
@override
String toString() => "HSVColor($alpha, $hue, $saturation, $value)";
String toString() => 'HSVColor($alpha, $hue, $saturation, $value)';
}
/// A color that has a small table of related colors called a "swatch".
......
......@@ -578,7 +578,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
RenderBox child = firstChild;
while (true) {
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
children.add(child.toDiagnosticsNode(name: "child with index ${childParentData.index}"));
children.add(child.toDiagnosticsNode(name: 'child with index ${childParentData.index}'));
if (child == lastChild)
break;
child = childParentData.nextSibling;
......@@ -588,7 +588,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
final List<int> indices = _keepAliveBucket.keys.toList()..sort();
for (int index in indices) {
children.add(_keepAliveBucket[index].toDiagnosticsNode(
name: "child with index $index (kept alive offstage)",
name: 'child with index $index (kept alive offstage)',
style: DiagnosticsTreeStyle.offstage,
));
}
......
......@@ -134,7 +134,7 @@ class RelativeRect {
int get hashCode => hashValues(left, top, right, bottom);
@override
String toString() => "RelativeRect.fromLTRB(${left?.toStringAsFixed(1)}, ${top?.toStringAsFixed(1)}, ${right?.toStringAsFixed(1)}, ${bottom?.toStringAsFixed(1)})";
String toString() => 'RelativeRect.fromLTRB(${left?.toStringAsFixed(1)}, ${top?.toStringAsFixed(1)}, ${right?.toStringAsFixed(1)}, ${bottom?.toStringAsFixed(1)})';
}
/// Parent data for use with [RenderStack].
......
......@@ -1167,7 +1167,7 @@ class RenderTable extends RenderBox {
description.add(new DiagnosticsProperty<TableColumnWidth>('default column width', defaultColumnWidth));
description.add(new MessageProperty('table size', '$columns\u00D7$rows'));
description.add(new IterableProperty<double>('column offsets', _columnLefts, ifNull: 'unknown'));
description.add(new IterableProperty<double>('row offsets', _rowTops, ifNull: "unknown"));
description.add(new IterableProperty<double>('row offsets', _rowTops, ifNull: 'unknown'));
}
@override
......
......@@ -246,7 +246,7 @@ class AssetImage extends AssetBundleImageProvider {
return candidates[lower];
}
static final RegExp _extractRatioRegExp = new RegExp(r"/?(\d+(\.\d*)?)x/");
static final RegExp _extractRatioRegExp = new RegExp(r'/?(\d+(\.\d*)?)x/');
double _parseScale(String key) {
final Match match = _extractRatioRegExp.firstMatch(key);
......
......@@ -150,7 +150,7 @@ class MethodChannel {
codec.encodeMethodCall(new MethodCall(method, arguments)),
);
if (result == null)
throw new MissingPluginException("No implementation found for method $method on channel $name");
throw new MissingPluginException('No implementation found for method $method on channel $name');
return codec.decodeEnvelope(result);
}
......
......@@ -367,7 +367,7 @@ class FocusScopeNode extends Object with DiagnosticableTreeMixin {
FocusScopeNode child = _firstChild;
int count = 1;
while (true) {
children.add(child.toDiagnosticsNode(name: "child $count"));
children.add(child.toDiagnosticsNode(name: 'child $count'));
if (child == _lastChild)
break;
child = child._nextSibling;
......
......@@ -3833,7 +3833,7 @@ class ParentDataElement<T extends RenderObjectWidget> extends ProxyElement {
throw new FlutterError(
'Incorrect use of ParentDataWidget.\n' +
widget.debugDescribeInvalidAncestorChain(
description: "$this",
description: '$this',
ownershipChain: parent.debugGetCreatorChain(10),
foundValidAncestor: ancestor != null,
badAncestors: badAncestors
......
......@@ -71,7 +71,7 @@ void main() {
box = tester.renderObject(find.byType(ExpansionPanelList));
expect(box.size.height - oldHeight, greaterThanOrEqualTo(100.0)); // 100 + some margin
});
testWidgets("Multiple Panel List test", (WidgetTester tester) async {
testWidgets('Multiple Panel List test', (WidgetTester tester) async {
await tester.pumpWidget(
new MaterialApp(
home: new ListView(
......
......@@ -16,8 +16,8 @@ void main() {
final RenderPositionedBox positioner = new RenderPositionedBox(child: sizer);
layout(positioner, constraints: new BoxConstraints.loose(const Size(200.0, 200.0)));
expect(positioner.size.width, equals(200.0), reason: "positioner width");
expect(positioner.size.height, equals(200.0), reason: "positioner height");
expect(positioner.size.width, equals(200.0), reason: 'positioner width');
expect(positioner.size.height, equals(200.0), reason: 'positioner height');
});
test('RenderPositionedBox shrink wraps', () {
......@@ -28,21 +28,21 @@ void main() {
final RenderPositionedBox positioner = new RenderPositionedBox(child: sizer, widthFactor: 1.0);
layout(positioner, constraints: new BoxConstraints.loose(const Size(200.0, 200.0)));
expect(positioner.size.width, equals(100.0), reason: "positioner width");
expect(positioner.size.height, equals(200.0), reason: "positioner height");
expect(positioner.size.width, equals(100.0), reason: 'positioner width');
expect(positioner.size.height, equals(200.0), reason: 'positioner height');
positioner.widthFactor = null;
positioner.heightFactor = 1.0;
pumpFrame();
expect(positioner.size.width, equals(200.0), reason: "positioner width");
expect(positioner.size.height, equals(100.0), reason: "positioner height");
expect(positioner.size.width, equals(200.0), reason: 'positioner width');
expect(positioner.size.height, equals(100.0), reason: 'positioner height');
positioner.widthFactor = 1.0;
pumpFrame();
expect(positioner.size.width, equals(100.0), reason: "positioner width");
expect(positioner.size.height, equals(100.0), reason: "positioner height");
expect(positioner.size.width, equals(100.0), reason: 'positioner width');
expect(positioner.size.height, equals(100.0), reason: 'positioner height');
});
test('RenderPositionedBox width and height factors', () {
......
......@@ -208,7 +208,7 @@ void main() {
..addAction(SemanticsAction.showOnScreen, () { })
..isChecked = false
..isSelected = true
..label = "Use all the properties"
..label = 'Use all the properties'
..textDirection = TextDirection.rtl;
final SemanticsNode allProperties = new SemanticsNode()
..rect = new Rect.fromLTWH(50.0, 10.0, 20.0, 30.0)
......
......@@ -13,11 +13,11 @@ class TestSchedulerBinding extends BindingBase with SchedulerBinding { }
void main() {
final SchedulerBinding scheduler = new TestSchedulerBinding();
test("Check for a time dilation being in effect", () {
test('Check for a time dilation being in effect', () {
expect(timeDilation, equals(1.0));
});
test("Can cancel queued callback", () {
test('Can cancel queued callback', () {
int secondId;
bool firstCallbackRan = false;
......
......@@ -96,7 +96,7 @@ class LogRecord {
///
/// It is meant to be read by humans. There's no guarantee that this value is
/// stable enough to be parsed by machines.
String get levelDescription => level.toString().split(".").last;
String get levelDescription => level.toString().split('.').last;
@override
String toString() => '[${levelDescription.padRight(5)}] $loggerName: $message';
......
......@@ -348,7 +348,7 @@ class GlobalMaterialLocalizations implements MaterialLocalizations {
/// Looks up text geometry defined in [MaterialTextGeometry].
@override
TextTheme get localTextGeometry => MaterialTextGeometry.forScriptCategory(_nameToValue["scriptCategory"]);
TextTheme get localTextGeometry => MaterialTextGeometry.forScriptCategory(_nameToValue['scriptCategory']);
/// Creates an object that provides localized resource values for the
/// for the widgets of the material library.
......
......@@ -142,7 +142,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
createHttpClient = () {
return new http.MockClient((http.BaseRequest request) {
return new Future<http.Response>.value(
new http.Response("Mocked: Unavailable.", 404, request: request)
new http.Response('Mocked: Unavailable.', 404, request: request)
);
});
};
......
......@@ -26,7 +26,7 @@ class _MockToStringDeep {
/// line break.
List<String> _lines;
String toStringDeep({ String prefixLineOne: "", String prefixOtherLines: "" }) {
String toStringDeep({ String prefixLineOne: '', String prefixOtherLines: '' }) {
final StringBuffer sb = new StringBuffer();
if (_lines.isNotEmpty)
sb.write('$prefixLineOne${_lines.first}');
......
......@@ -26,9 +26,9 @@ import '../lib/src/usage.dart';
// Note: this was largely inspired by lib/src/commands/test.dart.
const String _kOptionPackages = "packages";
const String _kOptionShell = "shell";
const String _kOptionTestDirectory = "test-directory";
const String _kOptionPackages = 'packages';
const String _kOptionShell = 'shell';
const String _kOptionTestDirectory = 'test-directory';
const List<String> _kRequiredOptions = const <String>[
_kOptionPackages,
_kOptionShell,
......
......@@ -175,7 +175,7 @@ Future<int> _handleToolError(
writelnStderr();
writelnStderr(
"Run 'flutter -h' (or 'flutter <command> -h') for available "
"flutter commands and options."
'flutter commands and options.'
);
// Argument error exit code.
return _exit(64);
......
......@@ -772,7 +772,7 @@ class _AndroidDevicePortForwarder extends DevicePortForwarder {
final List<String> lines = LineSplitter.split(stdout).toList();
for (String line in lines) {
if (line.startsWith(device.id)) {
final List<String> splitLine = line.split("tcp:");
final List<String> splitLine = line.split('tcp:');
// Sanity check splitLine.
if (splitLine.length != 3)
......
......@@ -43,7 +43,7 @@ FlutterPluginVersion get flutterPluginVersion {
final File plugin = fs.file('android/buildSrc/src/main/groovy/FlutterPlugin.groovy');
if (plugin.existsSync()) {
final String packageLine = plugin.readAsLinesSync().skip(4).first;
if (packageLine == "package io.flutter.gradle") {
if (packageLine == 'package io.flutter.gradle') {
return FlutterPluginVersion.v2;
}
return FlutterPluginVersion.v1;
......@@ -51,7 +51,7 @@ FlutterPluginVersion get flutterPluginVersion {
final File appGradle = fs.file('android/app/build.gradle');
if (appGradle.existsSync()) {
for (String line in appGradle.readAsLinesSync()) {
if (line.contains(new RegExp(r"apply from: .*/flutter.gradle"))) {
if (line.contains(new RegExp(r'apply from: .*/flutter.gradle'))) {
return FlutterPluginVersion.managed;
}
}
......
......@@ -116,7 +116,7 @@ class AndroidApk extends ApplicationPackage {
if (category.getAttribute('android:name') == 'android.intent.category.LAUNCHER') {
final xml.XmlElement activity = category.parent.parent;
final String activityName = activity.getAttribute('android:name');
launchActivity = "$packageId/$activityName";
launchActivity = '$packageId/$activityName';
break;
}
}
......
......@@ -40,5 +40,5 @@ class ToolExit implements Exception {
final int exitCode;
@override
String toString() => "Exception: $message";
String toString() => 'Exception: $message';
}
......@@ -118,13 +118,13 @@ class _PosixUtils extends OperatingSystemUtils {
if (_name == null) {
if (platform.isMacOS) {
final List<ProcessResult> results = <ProcessResult>[
processManager.runSync(<String>["sw_vers", "-productName"]),
processManager.runSync(<String>["sw_vers", "-productVersion"]),
processManager.runSync(<String>["sw_vers", "-buildVersion"]),
processManager.runSync(<String>['sw_vers', '-productName']),
processManager.runSync(<String>['sw_vers', '-productVersion']),
processManager.runSync(<String>['sw_vers', '-buildVersion']),
];
if (results.every((ProcessResult result) => result.exitCode == 0)) {
_name = "${results[0].stdout.trim()} ${results[1].stdout
.trim()} ${results[2].stdout.trim()}";
_name = '${results[0].stdout.trim()} ${results[1].stdout
.trim()} ${results[2].stdout.trim()}';
}
}
_name ??= super.name;
......
......@@ -298,7 +298,7 @@ void _traceCommand(List<String> args, { String workingDirectory }) {
if (workingDirectory == null)
printTrace(argsText);
else
printTrace("[$workingDirectory${fs.path.separator}] $argsText");
printTrace('[$workingDirectory${fs.path.separator}] $argsText');
}
String _runWithLoggingSync(List<String> cmd, {
......
......@@ -239,10 +239,10 @@ Future<String> _buildAotSnapshot(
];
if ((extraFrontEndOptions != null) && extraFrontEndOptions.isNotEmpty)
printTrace("Extra front-end options: $extraFrontEndOptions");
printTrace('Extra front-end options: $extraFrontEndOptions');
if ((extraGenSnapshotOptions != null) && extraGenSnapshotOptions.isNotEmpty) {
printTrace("Extra gen-snapshot options: $extraGenSnapshotOptions");
printTrace('Extra gen-snapshot options: $extraGenSnapshotOptions');
genSnapshotCmd.addAll(extraGenSnapshotOptions);
}
......
......@@ -83,7 +83,7 @@ class CreateCommand extends FlutterCommand {
'If run on a project that already exists, this will repair the project, recreating any files that are missing.';
@override
String get invocation => "${runner.executableName} $name <output directory>";
String get invocation => '${runner.executableName} $name <output directory>';
@override
Future<Null> runCommand() async {
......@@ -249,17 +249,17 @@ To edit platform code in an IDE see https://flutter.io/platform-plugins/#edit-co
}
} else {
printStatus("You'll need to install additional components before you can run "
"your Flutter app:");
'your Flutter app:');
printStatus('');
// Give the user more detailed analysis.
await doctor.diagnose();
printStatus('');
printStatus("After installing components, run 'flutter doctor' in order to "
"re-validate your setup.");
're-validate your setup.');
printStatus("When complete, type 'flutter run' from the '$relativeAppPath' "
"directory in order to launch your app.");
printStatus("Your main program file is: $relativeAppPath/lib/main.dart");
'directory in order to launch your app.');
printStatus('Your main program file is: $relativeAppPath/lib/main.dart');
}
}
......@@ -290,7 +290,7 @@ To edit platform code in an IDE see https://flutter.io/platform-plugins/#edit-co
'dartSdk': '$flutterRoot/bin/cache/dart-sdk',
'androidMinApiLevel': android.minApiLevel,
'androidSdkVersion': android_sdk.minimumAndroidSdkVersion,
'androidFlutterJar': "$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar",
'androidFlutterJar': '$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar',
'withDriverTest': renderDriverTest,
'pluginClass': pluginClass,
'pluginDartClass': pluginDartClass,
......@@ -333,7 +333,7 @@ String _createPluginClassName(String name) {
String _createUTIIdentifier(String organization, String name) {
// Create a UTI (https://en.wikipedia.org/wiki/Uniform_Type_Identifier) from a base name
final RegExp disallowed = new RegExp(r"[^a-zA-Z0-9\-\.\u0080-\uffff]+");
final RegExp disallowed = new RegExp(r'[^a-zA-Z0-9\-\.\u0080-\uffff]+');
name = camelCase(name).replaceAll(disallowed, '');
name = name.isEmpty ? 'untitled' : name;
return '$organization.$name';
......@@ -367,7 +367,7 @@ String _validateProjectName(String projectName) {
if (_packageDependencies.contains(projectName)) {
return "Invalid project name: '$projectName' - this will conflict with Flutter "
"package dependencies.";
'package dependencies.';
}
return null;
}
......@@ -376,7 +376,7 @@ String _validateProjectName(String projectName) {
/// if we should disallow the directory name.
String _validateProjectDir(String dirPath, { String flutterRoot }) {
if (fs.path.isWithin(flutterRoot, dirPath)) {
return "Cannot create a project within the Flutter SDK.\n"
return 'Cannot create a project within the Flutter SDK.\n'
"Target directory '$dirPath' is within the Flutter SDK at '$flutterRoot'.";
}
......
......@@ -197,28 +197,28 @@ abstract class Domain {
String _getStringArg(Map<String, dynamic> args, String name, { bool required: false }) {
if (required && !args.containsKey(name))
throw "$name is required";
throw '$name is required';
final dynamic val = args[name];
if (val != null && val is! String)
throw "$name is not a String";
throw '$name is not a String';
return val;
}
bool _getBoolArg(Map<String, dynamic> args, String name, { bool required: false }) {
if (required && !args.containsKey(name))
throw "$name is required";
throw '$name is required';
final dynamic val = args[name];
if (val != null && val is! bool)
throw "$name is not a bool";
throw '$name is not a bool';
return val;
}
int _getIntArg(Map<String, dynamic> args, String name, { bool required: false }) {
if (required && !args.containsKey(name))
throw "$name is required";
throw '$name is required';
final dynamic val = args[name];
if (val != null && val is! int)
throw "$name is not an int";
throw '$name is not an int';
return val;
}
......
......@@ -23,7 +23,7 @@ class DevicesCommand extends FlutterCommand {
if (!doctor.canListAnything) {
throwToolExit(
"Unable to locate a development device; please run 'flutter doctor' for "
"information about installing additional components.",
'information about installing additional components.',
exitCode: 1);
}
......
......@@ -21,7 +21,7 @@ class FormatCommand extends FlutterCommand {
final String description = 'Format one or more dart files.';
@override
String get invocation => "${runner.executableName} $name <one or more paths>";
String get invocation => '${runner.executableName} $name <one or more paths>';
@override
Future<Null> runCommand() async {
......
......@@ -256,9 +256,9 @@ class FuchsiaReloadCommand extends FlutterCommand {
// The Observatory requires somewhat non-standard URIs that the Uri class
// can't build for us, so instead we build them by hand.
final String isolateIdQuery = "?isolateId=isolates%2F$number";
final String isolateAddr = "$vmServiceAddr/#/inspect$isolateIdQuery";
final String debuggerAddr = "$vmServiceAddr/#/debugger$isolateIdQuery";
final String isolateIdQuery = '?isolateId=isolates%2F$number';
final String isolateAddr = '$vmServiceAddr/#/inspect$isolateIdQuery';
final String debuggerAddr = '$vmServiceAddr/#/debugger$isolateIdQuery';
final String newUsed = getSizeAsMB(isolate.newSpace.used);
final String newCap = getSizeAsMB(isolate.newSpace.capacity);
......@@ -452,7 +452,7 @@ class _PortForwarder {
final ProcessResult result = await processManager.run(command);
printTrace(command.join(' '));
if (result.exitCode != 0) {
printTrace("Command failed:\nstdout: ${result.stdout}\nstderr: ${result.stderr}");
printTrace('Command failed:\nstdout: ${result.stdout}\nstderr: ${result.stderr}');
}
}
......@@ -487,7 +487,7 @@ class FuchsiaDeviceCommandRunner {
printTrace(args.join(' '));
final ProcessResult result = await processManager.run(args);
if (result.exitCode != 0) {
printStatus("Command failed: $command\nstdout: ${result.stdout}\nstderr: ${result.stderr}");
printStatus('Command failed: $command\nstdout: ${result.stdout}\nstderr: ${result.stderr}');
return null;
}
printTrace(result.stdout);
......
......@@ -498,10 +498,10 @@ class DevFS {
try {
await _httpWriter.write(dirtyEntries);
} on SocketException catch (socketException, stackTrace) {
printTrace("DevFS sync failed. Lost connection to device: $socketException");
printTrace('DevFS sync failed. Lost connection to device: $socketException');
throw new DevFSException('Lost connection to device.', socketException, stackTrace);
} catch (exception, stackTrace) {
printError("Could not update files on device: $exception");
printError('Could not update files on device: $exception');
throw new DevFSException('Sync failed', exception, stackTrace);
}
} else {
......
......@@ -191,7 +191,7 @@ abstract class Device {
// String meant to be displayed to the user indicating if the device is
// supported by Flutter, and, if not, why.
String supportMessage() => isSupported() ? "Supported" : "Unsupported";
String supportMessage() => isSupported() ? 'Supported' : 'Unsupported';
/// The device's platform.
Future<TargetPlatform> get targetPlatform;
......
......@@ -286,7 +286,7 @@ Future<XcodeBuildResult> buildXcodeProject({
commands.addAll(<String>[
'-workspace', fs.path.basename(entity.path),
'-scheme', scheme,
"BUILD_DIR=${fs.path.absolute(getIosBuildDirectory())}",
'BUILD_DIR=${fs.path.absolute(getIosBuildDirectory())}',
]);
break;
}
......@@ -447,20 +447,20 @@ bool _checkXcodeVersion() {
Future<Null> _addServicesToBundle(Directory bundle) async {
final List<Map<String, String>> services = <Map<String, String>>[];
printTrace("Trying to resolve native pub services.");
printTrace('Trying to resolve native pub services.');
// Step 1: Parse the service configuration yaml files present in the service
// pub packages.
await parseServiceConfigs(services);
printTrace("Found ${services.length} service definition(s).");
printTrace('Found ${services.length} service definition(s).');
// Step 2: Copy framework dylibs to the correct spot for xcodebuild to pick up.
final Directory frameworksDirectory = fs.directory(fs.path.join(bundle.path, "Frameworks"));
final Directory frameworksDirectory = fs.directory(fs.path.join(bundle.path, 'Frameworks'));
await _copyServiceFrameworks(services, frameworksDirectory);
// Step 3: Copy the service definitions manifest at the correct spot for
// xcodebuild to pick up.
final File manifestFile = fs.file(fs.path.join(bundle.path, "ServiceDefinitions.json"));
final File manifestFile = fs.file(fs.path.join(bundle.path, 'ServiceDefinitions.json'));
_copyServiceDefinitionsManifest(services, manifestFile);
}
......@@ -470,7 +470,7 @@ Future<Null> _copyServiceFrameworks(List<Map<String, String>> services, Director
for (Map<String, String> service in services) {
final String dylibPath = await getServiceFromUrl(service['ios-framework'], service['root'], service['name']);
final File dylib = fs.file(dylibPath);
printTrace("Copying ${dylib.path} into bundle.");
printTrace('Copying ${dylib.path} into bundle.');
if (!dylib.existsSync()) {
printError("The service dylib '${dylib.path}' does not exist.");
continue;
......
......@@ -5,8 +5,8 @@
import '../base/file_system.dart';
import '../base/process.dart';
const String kCFBundleIdentifierKey = "CFBundleIdentifier";
const String kCFBundleShortVersionStringKey = "CFBundleShortVersionString";
const String kCFBundleIdentifierKey = 'CFBundleIdentifier';
const String kCFBundleShortVersionStringKey = 'CFBundleShortVersionString';
String getValueFromFile(String plistFilePath, String key) {
// TODO(chinmaygarde): For now, we only need to read from plist files on a mac
......
......@@ -433,7 +433,7 @@ class HotRunner extends ResidentRunner {
timer.stop();
status.cancel();
if (result.isOk)
printStatus("${result.message} in ${getElapsedAsMilliseconds(timer.elapsed)}.");
printStatus('${result.message} in ${getElapsedAsMilliseconds(timer.elapsed)}.');
if (result.hint != null)
printStatus(result.hint);
return result;
......@@ -530,7 +530,7 @@ class HotRunner extends ResidentRunner {
reloadMessage = 'Reloaded $loadedLibraryCount of $finalLibraryCount libraries';
}
} catch (error, st) {
printError("Hot reload failed: $error\n$st");
printError('Hot reload failed: $error\n$st');
final int errorCode = error['code'];
final String errorMessage = error['message'];
if (errorCode == Isolate.kIsolateReloadBarred) {
......@@ -587,8 +587,8 @@ class HotRunner extends ResidentRunner {
await view.uiIsolate.flutterReassemble();
} on TimeoutException {
reassembleTimedOut = true;
printTrace("Reassembling ${view.uiIsolate.name} took too long.");
printStatus("Hot reloading ${view.uiIsolate.name} took too long; the reload may have failed.");
printTrace('Reassembling ${view.uiIsolate.name} took too long.');
printStatus('Hot reloading ${view.uiIsolate.name} took too long; the reload may have failed.');
continue;
} catch (error) {
reassembleAndScheduleErrors = true;
......
......@@ -265,18 +265,18 @@ abstract class FlutterCommand extends Command<Null> {
Future<List<Device>> findAllTargetDevices() async {
if (!doctor.canLaunchAnything) {
printError("Unable to locate a development device; please run 'flutter doctor' "
"for information about installing additional components.");
'for information about installing additional components.');
return null;
}
List<Device> devices = await deviceManager.getDevices().toList();
if (devices.isEmpty && deviceManager.hasSpecifiedDeviceId) {
printStatus("No devices found with name or id "
printStatus('No devices found with name or id '
"matching '${deviceManager.specifiedDeviceId}'");
return null;
} else if (devices.isEmpty && deviceManager.hasSpecifiedAllDevices) {
printStatus("No devices found");
printStatus('No devices found');
return null;
} else if (devices.isEmpty) {
printNoConnectedDevices();
......@@ -290,10 +290,10 @@ abstract class FlutterCommand extends Command<Null> {
return null;
} else if (devices.length > 1 && !deviceManager.hasSpecifiedAllDevices) {
if (deviceManager.hasSpecifiedDeviceId) {
printStatus("Found ${devices.length} devices with name or id matching "
printStatus('Found ${devices.length} devices with name or id matching '
"'${deviceManager.specifiedDeviceId}':");
} else {
printStatus("More than one device connected; please specify a device with "
printStatus('More than one device connected; please specify a device with '
"the '-d <deviceId>' flag, or use '-d all' to act on all devices.");
devices = await deviceManager.getAllConnectedDevices().toList();
}
......@@ -313,7 +313,7 @@ abstract class FlutterCommand extends Command<Null> {
if (deviceList == null)
return null;
if (deviceList.length > 1) {
printStatus("More than one device connected; please specify a device with "
printStatus('More than one device connected; please specify a device with '
"the '-d <deviceId>' flag.");
deviceList = await deviceManager.getAllConnectedDevices().toList();
printStatus('');
......
......@@ -75,10 +75,10 @@ Future<Null> parseServiceConfigs(
}
Future<String> getServiceFromUrl(String url, String rootDir, String serviceName) async {
if (url.startsWith("android-sdk:") && androidSdk != null) {
if (url.startsWith('android-sdk:') && androidSdk != null) {
// It's something shipped in the standard android SDK.
return url.replaceAll('android-sdk:', '${androidSdk.directory}/');
} else if (url.startsWith("http")) {
} else if (url.startsWith('http')) {
// It's a regular file to download.
return await cache.getThirdPartyFile(url, serviceName);
} else {
......
......@@ -10,7 +10,7 @@ import 'globals.dart';
const String _kTemplateExtension = '.tmpl';
const String _kCopyTemplateExtension = '.copy.tmpl';
final Pattern _kTemplateLanguageVariant = new RegExp(r"(\w+)-(\w+)\.tmpl.*");
final Pattern _kTemplateLanguageVariant = new RegExp(r'(\w+)-(\w+)\.tmpl.*');
/// Expands templates in a directory to a destination. All files that must
/// undergo template expansion should end with the '.tmpl' extension. All other
......
......@@ -15,8 +15,8 @@ class EventPrinter extends TestWatcher {
@override
void onStartedProcess(ProcessEvent event) {
_sendEvent("test.startedProcess",
<String, dynamic>{"observatoryUri": event.observatoryUri.toString()});
_sendEvent('test.startedProcess',
<String, dynamic>{'observatoryUri': event.observatoryUri.toString()});
}
void _sendEvent(String name, [dynamic params]) {
......
......@@ -408,8 +408,8 @@ class _FlutterPlatform extends PlatformPlugin {
String _getWebSocketUrl(HttpServer server) {
return host.type == InternetAddressType.IP_V4
? "ws://${host.address}:${server.port}"
: "ws://[${host.address}]:${server.port}";
? 'ws://${host.address}:${server.port}'
: 'ws://[${host.address}]:${server.port}';
}
String _generateTestMain({
......
......@@ -44,11 +44,11 @@ Future<int> runTests(
}
for (String name in names) {
testArgs..add("--name")..add(name);
testArgs..add('--name')..add(name);
}
for (String plainName in plainNames) {
testArgs..add("--plain-name")..add(plainName);
testArgs..add('--plain-name')..add(plainName);
}
testArgs.add('--');
......
......@@ -321,7 +321,7 @@ abstract class ServiceObject {
return null;
if (!_isServiceMap(map))
throw new VMServiceObjectLoadError("Expected a service map", map);
throw new VMServiceObjectLoadError('Expected a service map', map);
final String type = _stripRef(map['type']);
......@@ -435,7 +435,7 @@ abstract class ServiceObject {
final String mapType = _stripRef(map['type']);
if ((_type != null) && (_type != mapType)) {
throw new VMServiceObjectLoadError("ServiceObject types must not change",
throw new VMServiceObjectLoadError('ServiceObject types must not change',
map);
}
_type = mapType;
......@@ -443,7 +443,7 @@ abstract class ServiceObject {
_canCache = map['fixedId'] == true;
if ((_id != null) && (_id != map['id']) && _canCache) {
throw new VMServiceObjectLoadError("ServiceObject id changed", map);
throw new VMServiceObjectLoadError('ServiceObject id changed', map);
}
_id = map['id'];
......@@ -1061,7 +1061,7 @@ class Isolate extends ServiceObjectOwner {
if (ownerType == 'Library' || ownerType == '@Library')
break;
final String ownerName = owner['name'];
name = "$ownerName.$name";
name = '$ownerName.$name';
owner = owner['owner'];
}
......
......@@ -47,7 +47,7 @@ $fontsSection
}
void writePackagesFile(String packages) {
fs.file(".packages")
fs.file('.packages')
..createSync()
..writeAsStringSync(packages);
}
......
......@@ -55,7 +55,7 @@ $assetsSection
}
void writePackagesFile(String packages) {
fs.file(".packages")
fs.file('.packages')
..createSync()
..writeAsStringSync(packages);
}
......@@ -155,7 +155,7 @@ $assetsSection
expectedAssetManifest,
);
}, overrides: contextOverrides);
testUsingContext("One asset is bundled when the package has one asset, listed in the app's pubspec", () async {
establishFlutterRoot();
......@@ -180,7 +180,7 @@ $assetsSection
);
}, overrides: contextOverrides);
testUsingContext("One asset and its variant are bundled when the package has an asset and a variant, and lists the asset in its pubspec", () async {
testUsingContext('One asset and its variant are bundled when the package has an asset and a variant, and lists the asset in its pubspec', () async {
establishFlutterRoot();
writePubspecFile('pubspec.yaml', 'test');
......@@ -204,7 +204,7 @@ $assetsSection
);
}, overrides: contextOverrides);
testUsingContext("One asset and its variant are bundled when the package has an asset and a variant, and the app lists the asset in its pubspec", () async {
testUsingContext('One asset and its variant are bundled when the package has an asset and a variant, and the app lists the asset in its pubspec', () async {
establishFlutterRoot();
writePubspecFile(
......@@ -231,7 +231,7 @@ $assetsSection
);
}, overrides: contextOverrides);
testUsingContext("Two assets are bundled when the package has and lists two assets in its pubspec", () async {
testUsingContext('Two assets are bundled when the package has and lists two assets in its pubspec', () async {
establishFlutterRoot();
writePubspecFile('pubspec.yaml', 'test');
......@@ -288,7 +288,7 @@ $assetsSection
);
}, overrides: contextOverrides);
testUsingContext("Two assets are bundled when two packages each have and list an asset their pubspec", () async {
testUsingContext('Two assets are bundled when two packages each have and list an asset their pubspec', () async {
establishFlutterRoot();
writePubspecFile(
......@@ -323,7 +323,7 @@ $assetsSection
expectedAssetManifest,
);
}, overrides: contextOverrides);
testUsingContext("Two assets are bundled when two packages each have an asset, listed in the app's pubspec", () async {
establishFlutterRoot();
......@@ -363,7 +363,7 @@ $assetsSection
);
}, overrides: contextOverrides);
testUsingContext("One asset is bundled when the app depends on a package, listing in its pubspec an asset from another package", () async {
testUsingContext('One asset is bundled when the app depends on a package, listing in its pubspec an asset from another package', () async {
establishFlutterRoot();
writePubspecFile(
'pubspec.yaml',
......
......@@ -23,7 +23,7 @@ void main() {
// path separator.
Cache.flutterRoot = getFlutterRoot();
fs.file("pubspec.yaml")
fs.file('pubspec.yaml')
..createSync()
..writeAsStringSync(
'''
......@@ -36,7 +36,7 @@ flutter:
- a/b/c/foo
'''
);
fs.file(".packages")..createSync();
fs.file('.packages')..createSync();
final List<String> assets = <String>[
'a/b/c/foo',
......
......@@ -261,7 +261,7 @@ void main() {
Cache.flutterRoot = '../..';
final CreateCommand command = new CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command);
final File existingFile = fs.file("${projectDir.path.toString()}/bad");
final File existingFile = fs.file('${projectDir.path.toString()}/bad');
if (!existingFile.existsSync())
existingFile.createSync(recursive: true);
expect(
......
......@@ -277,12 +277,12 @@ class MemoryIOSink implements IOSink {
}
@override
void writeln([Object obj = ""]) {
void writeln([Object obj = '']) {
add(encoding.encode('$obj\n'));
}
@override
void writeAll(Iterable<dynamic> objects, [String separator = ""]) {
void writeAll(Iterable<dynamic> objects, [String separator = '']) {
bool addSeparator = false;
for (dynamic object in objects) {
if (addSeparator) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment