Unverified Commit 64db6219 authored by Nils Reichardt's avatar Nils Reichardt Committed by GitHub

Remove `new` keyword in a few files (#104438)

parent a939d9d7
...@@ -54,7 +54,7 @@ double _doProbability({required double mean, required double stddev, required do ...@@ -54,7 +54,7 @@ double _doProbability({required double mean, required double stddev, required do
/// Example: /// Example:
/// ///
/// BenchmarkResultPrinter printer = new BenchmarkResultPrinter(); /// BenchmarkResultPrinter printer = BenchmarkResultPrinter();
/// printer.add( /// printer.add(
/// description: 'Average frame time', /// description: 'Average frame time',
/// value: averageFrameTime, /// value: averageFrameTime,
......
...@@ -14,10 +14,10 @@ import 'text_painter.dart'; ...@@ -14,10 +14,10 @@ import 'text_painter.dart';
const String _kDefaultDebugLabel = 'unknown'; const String _kDefaultDebugLabel = 'unknown';
const String _kColorForegroundWarning = 'Cannot provide both a color and a foreground\n' const String _kColorForegroundWarning = 'Cannot provide both a color and a foreground\n'
'The color argument is just a shorthand for "foreground: new Paint()..color = color".'; 'The color argument is just a shorthand for "foreground: Paint()..color = color".';
const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor and a background\n' const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor and a background\n'
'The backgroundColor argument is just a shorthand for "background: new Paint()..color = color".'; 'The backgroundColor argument is just a shorthand for "background: Paint()..color = color".';
// The default font size if none is specified. This should be kept in // The default font size if none is specified. This should be kept in
// sync with the default values in text_painter.dart, as well as the // sync with the default values in text_painter.dart, as well as the
......
...@@ -144,8 +144,8 @@ class AndroidView extends StatefulWidget { ...@@ -144,8 +144,8 @@ class AndroidView extends StatefulWidget {
/// child: AndroidView( /// child: AndroidView(
/// viewType: 'webview', /// viewType: 'webview',
/// gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[ /// gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
/// new Factory<OneSequenceGestureRecognizer>( /// Factory<OneSequenceGestureRecognizer>(
/// () => new EagerGestureRecognizer(), /// () => EagerGestureRecognizer(),
/// ), /// ),
/// ].toSet(), /// ].toSet(),
/// ), /// ),
...@@ -284,8 +284,8 @@ class UiKitView extends StatefulWidget { ...@@ -284,8 +284,8 @@ class UiKitView extends StatefulWidget {
/// child: UiKitView( /// child: UiKitView(
/// viewType: 'webview', /// viewType: 'webview',
/// gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[ /// gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
/// new Factory<OneSequenceGestureRecognizer>( /// Factory<OneSequenceGestureRecognizer>(
/// () => new EagerGestureRecognizer(), /// () => EagerGestureRecognizer(),
/// ), /// ),
/// ].toSet(), /// ].toSet(),
/// ), /// ),
...@@ -994,8 +994,8 @@ class PlatformViewSurface extends LeafRenderObjectWidget { ...@@ -994,8 +994,8 @@ class PlatformViewSurface extends LeafRenderObjectWidget {
/// height: 100.0, /// height: 100.0,
/// child: PlatformViewSurface( /// child: PlatformViewSurface(
/// gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[ /// gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
/// new Factory<OneSequenceGestureRecognizer>( /// Factory<OneSequenceGestureRecognizer>(
/// () => new EagerGestureRecognizer(), /// () => EagerGestureRecognizer(),
/// ), /// ),
/// ].toSet(), /// ].toSet(),
/// ), /// ),
......
...@@ -32,7 +32,7 @@ abstract class PreferredSizeWidget implements Widget { ...@@ -32,7 +32,7 @@ abstract class PreferredSizeWidget implements Widget {
/// In many cases it's only necessary to define one preferred dimension. /// In many cases it's only necessary to define one preferred dimension.
/// For example the [Scaffold] only depends on its app bar's preferred /// For example the [Scaffold] only depends on its app bar's preferred
/// height. In that case implementations of this method can just return /// height. In that case implementations of this method can just return
/// `new Size.fromHeight(myAppBarHeight)`. /// `Size.fromHeight(myAppBarHeight)`.
Size get preferredSize; Size get preferredSize;
} }
......
...@@ -295,7 +295,7 @@ typedef ChildIndexGetter = int? Function(Key key); ...@@ -295,7 +295,7 @@ typedef ChildIndexGetter = int? Function(Key key);
/// {@end-tool} /// {@end-tool}
/// ///
/// In certain cases, only a subset of child widgets should be annotated /// In certain cases, only a subset of child widgets should be annotated
/// with a semantic index. For example, in [new ListView.separated()] the /// with a semantic index. For example, in [ListView.separated()] the
/// separators do not have an index associated with them. This is done by /// separators do not have an index associated with them. This is done by
/// providing a `semanticIndexCallback` which returns null for separators /// providing a `semanticIndexCallback` which returns null for separators
/// indexes and rounds the non-separator indexes down by half. /// indexes and rounds the non-separator indexes down by half.
...@@ -541,7 +541,7 @@ class SliverChildBuilderDelegate extends SliverChildDelegate { ...@@ -541,7 +541,7 @@ class SliverChildBuilderDelegate extends SliverChildDelegate {
/// second delegate should offset its children by 10. /// second delegate should offset its children by 10.
/// ///
/// In certain cases, only a subset of child widgets should be annotated /// In certain cases, only a subset of child widgets should be annotated
/// with a semantic index. For example, in [new ListView.separated()] the /// with a semantic index. For example, in [ListView.separated()] the
/// separators do not have an index associated with them. This is done by /// separators do not have an index associated with them. This is done by
/// providing a `semanticIndexCallback` which returns null for separators /// providing a `semanticIndexCallback` which returns null for separators
/// indexes and rounds the non-separator indexes down by half. /// indexes and rounds the non-separator indexes down by half.
......
...@@ -102,7 +102,7 @@ void main() { ...@@ -102,7 +102,7 @@ void main() {
within<HSVColor>(distance: _doubleColorPrecision, from: hsvColor), within<HSVColor>(distance: _doubleColorPrecision, from: hsvColor),
); );
} }
// output.add(new HSVColor.fromAHSV(1.0, 0.0, 1.0, value).toColor()); // output.add(HSVColor.fromAHSV(1.0, 0.0, 1.0, value).toColor());
} }
final List<Color> expectedColors = <Color>[ final List<Color> expectedColors = <Color>[
const Color(0xff000000), const Color(0xff000000),
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/// ///
/// main() { /// main() {
/// enableFlutterDriverExtension(); /// enableFlutterDriverExtension();
/// runApp(new ExampleApp()); /// runApp(ExampleApp());
/// } /// }
library flutter_driver_extension; library flutter_driver_extension;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
/// Example: /// Example:
/// ///
/// enum Vote { yea, nay } /// enum Vote { yea, nay }
/// final index = new EnumIndex(Vote.values); /// final index = EnumIndex(Vote.values);
/// index.lookupBySimpleName('yea'); // returns Vote.yea /// index.lookupBySimpleName('yea'); // returns Vote.yea
/// index.toSimpleName(Vote.nay); // returns 'nay' /// index.toSimpleName(Vote.nay); // returns 'nay'
class EnumIndex<E> { class EnumIndex<E> {
......
...@@ -32,7 +32,7 @@ import 'widgets_localizations.dart'; ...@@ -32,7 +32,7 @@ import 'widgets_localizations.dart';
/// app supports with [CupertinoApp.supportedLocales]: /// app supports with [CupertinoApp.supportedLocales]:
/// ///
/// ```dart /// ```dart
/// new CupertinoApp( /// CupertinoApp(
/// localizationsDelegates: GlobalCupertinoLocalizations.delegates, /// localizationsDelegates: GlobalCupertinoLocalizations.delegates,
/// supportedLocales: [ /// supportedLocales: [
/// const Locale('en', 'US'), // American English /// const Locale('en', 'US'), // American English
...@@ -438,7 +438,7 @@ abstract class GlobalCupertinoLocalizations implements CupertinoLocalizations { ...@@ -438,7 +438,7 @@ abstract class GlobalCupertinoLocalizations implements CupertinoLocalizations {
/// app supports with [CupertinoApp.supportedLocales]: /// app supports with [CupertinoApp.supportedLocales]:
/// ///
/// ```dart /// ```dart
/// new CupertinoApp( /// CupertinoApp(
/// localizationsDelegates: GlobalCupertinoLocalizations.delegates, /// localizationsDelegates: GlobalCupertinoLocalizations.delegates,
/// supportedLocales: [ /// supportedLocales: [
/// const Locale('en', 'US'), // English /// const Locale('en', 'US'), // English
......
...@@ -30,7 +30,7 @@ import 'widgets_localizations.dart'; ...@@ -30,7 +30,7 @@ import 'widgets_localizations.dart';
/// app supports with [MaterialApp.supportedLocales]: /// app supports with [MaterialApp.supportedLocales]:
/// ///
/// ```dart /// ```dart
/// new MaterialApp( /// MaterialApp(
/// localizationsDelegates: GlobalMaterialLocalizations.delegates, /// localizationsDelegates: GlobalMaterialLocalizations.delegates,
/// supportedLocales: [ /// supportedLocales: [
/// const Locale('en', 'US'), // American English /// const Locale('en', 'US'), // American English
...@@ -682,7 +682,7 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations { ...@@ -682,7 +682,7 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations {
/// app supports with [MaterialApp.supportedLocales]: /// app supports with [MaterialApp.supportedLocales]:
/// ///
/// ```dart /// ```dart
/// new MaterialApp( /// MaterialApp(
/// localizationsDelegates: GlobalMaterialLocalizations.delegates, /// localizationsDelegates: GlobalMaterialLocalizations.delegates,
/// supportedLocales: [ /// supportedLocales: [
/// const Locale('en', 'US'), // English /// const Locale('en', 'US'), // English
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
/// ///
/// main () { /// main () {
/// // prevent prefer_const_constructors lint /// // prevent prefer_const_constructors lint
/// new A(nonconst(null)); /// A(nonconst(null));
/// ///
/// // prevent prefer_const_declarations lint /// // prevent prefer_const_declarations lint
/// final int $null = nonconst(null); /// final int $null = nonconst(null);
......
...@@ -25,7 +25,7 @@ class BasicProject extends Project { ...@@ -25,7 +25,7 @@ class BasicProject extends Project {
Future<void> main() async { Future<void> main() async {
while (true) { while (true) {
runApp(new MyApp()); runApp(MyApp());
await Future.delayed(const Duration(milliseconds: 50)); await Future.delayed(const Duration(milliseconds: 50));
} }
} }
...@@ -34,9 +34,9 @@ class BasicProject extends Project { ...@@ -34,9 +34,9 @@ class BasicProject extends Project {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
topLevelFunction(); topLevelFunction();
return new MaterialApp( // BUILD BREAKPOINT return MaterialApp( // BUILD BREAKPOINT
title: 'Flutter Demo', title: 'Flutter Demo',
home: new Container(), home: Container(),
); );
} }
} }
...@@ -136,7 +136,7 @@ class BasicProjectWithTimelineTraces extends Project { ...@@ -136,7 +136,7 @@ class BasicProjectWithTimelineTraces extends Project {
Future<void> main() async { Future<void> main() async {
while (true) { while (true) {
runApp(new MyApp()); runApp(MyApp());
await Future.delayed(const Duration(milliseconds: 50)); await Future.delayed(const Duration(milliseconds: 50));
Timeline.instantSync('main'); Timeline.instantSync('main');
} }
...@@ -146,9 +146,9 @@ class BasicProjectWithTimelineTraces extends Project { ...@@ -146,9 +146,9 @@ class BasicProjectWithTimelineTraces extends Project {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
topLevelFunction(); topLevelFunction();
return new MaterialApp( // BUILD BREAKPOINT return MaterialApp( // BUILD BREAKPOINT
title: 'Flutter Demo', title: 'Flutter Demo',
home: new Container(), home: Container(),
); );
} }
} }
...@@ -208,7 +208,7 @@ class BasicProjectWithUnaryMain extends Project { ...@@ -208,7 +208,7 @@ class BasicProjectWithUnaryMain extends Project {
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
Future<void> main(List<String> args) async { Future<void> main(List<String> args) async {
while (true) { while (true) {
runApp(new MyApp()); runApp(MyApp());
await Future.delayed(const Duration(milliseconds: 50)); await Future.delayed(const Duration(milliseconds: 50));
} }
} }
...@@ -216,9 +216,9 @@ class BasicProjectWithUnaryMain extends Project { ...@@ -216,9 +216,9 @@ class BasicProjectWithUnaryMain extends Project {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
topLevelFunction(); topLevelFunction();
return new MaterialApp( // BUILD BREAKPOINT return MaterialApp( // BUILD BREAKPOINT
title: 'Flutter Demo', title: 'Flutter Demo',
home: new Container(), home: Container(),
); );
} }
} }
......
...@@ -45,7 +45,7 @@ class DeferredComponentsProject extends Project { ...@@ -45,7 +45,7 @@ class DeferredComponentsProject extends Project {
libFuture = DeferredLibrary.loadLibrary(); libFuture = DeferredLibrary.loadLibrary();
libFuture?.whenComplete(() => deferredText = 'complete ${DeferredLibrary.add(10, 42)}'); libFuture?.whenComplete(() => deferredText = 'complete ${DeferredLibrary.add(10, 42)}');
} }
runApp(new MyApp()); runApp(MyApp());
await Future.delayed(const Duration(milliseconds: 50)); await Future.delayed(const Duration(milliseconds: 50));
} }
} }
...@@ -54,9 +54,9 @@ class DeferredComponentsProject extends Project { ...@@ -54,9 +54,9 @@ class DeferredComponentsProject extends Project {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
topLevelFunction(); topLevelFunction();
return new MaterialApp( // BUILD BREAKPOINT return MaterialApp( // BUILD BREAKPOINT
title: 'Flutter Demo', title: 'Flutter Demo',
home: new Container(), home: Container(),
); );
} }
} }
......
...@@ -77,9 +77,9 @@ class MultidexProject extends Project { ...@@ -77,9 +77,9 @@ class MultidexProject extends Project {
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new MaterialApp( return MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
home: new Container(), home: Container(),
); );
} }
} }
......
...@@ -25,7 +25,7 @@ class ProjectWithEarlyError extends Project { ...@@ -25,7 +25,7 @@ class ProjectWithEarlyError extends Project {
Future<void> main() async { Future<void> main() async {
while (true) { while (true) {
runApp(new MyApp()); runApp(MyApp());
await Future.delayed(const Duration(milliseconds: 50)); await Future.delayed(const Duration(milliseconds: 50));
} }
} }
......
...@@ -21,7 +21,7 @@ class SteppingProject extends Project { ...@@ -21,7 +21,7 @@ class SteppingProject extends Project {
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() => runApp(new MyApp()); void main() => runApp(MyApp());
class MyApp extends StatefulWidget { class MyApp extends StatefulWidget {
@override @override
...@@ -37,17 +37,17 @@ class SteppingProject extends Project { ...@@ -37,17 +37,17 @@ class SteppingProject extends Project {
Future<void> doAsyncStuff() async { Future<void> doAsyncStuff() async {
print("test"); // BREAKPOINT print("test"); // BREAKPOINT
await new Future.value(true); // STEP 1 // STEP 2 await Future.value(true); // STEP 1 // STEP 2
await new Future.microtask(() => true); // STEP 3 // STEP 4 await Future.microtask(() => true); // STEP 3 // STEP 4
await new Future.delayed(const Duration(milliseconds: 1)); // STEP 5 // STEP 6 await Future.delayed(const Duration(milliseconds: 1)); // STEP 5 // STEP 6
print("done!"); // STEP 7 print("done!"); // STEP 7
} // STEP 8 } // STEP 8
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new MaterialApp( return MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
home: new Container(), home: Container(),
); );
} }
} }
...@@ -77,7 +77,7 @@ class WebSteppingProject extends Project { ...@@ -77,7 +77,7 @@ class WebSteppingProject extends Project {
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() => runApp(new MyApp()); void main() => runApp(MyApp());
class MyApp extends StatefulWidget { class MyApp extends StatefulWidget {
@override @override
...@@ -93,17 +93,17 @@ class WebSteppingProject extends Project { ...@@ -93,17 +93,17 @@ class WebSteppingProject extends Project {
Future<void> doAsyncStuff() async { Future<void> doAsyncStuff() async {
print("test"); // BREAKPOINT print("test"); // BREAKPOINT
await new Future.value(true); // STEP 1 await Future.value(true); // STEP 1
await new Future.microtask(() => true); // STEP 2 await Future.microtask(() => true); // STEP 2
await new Future.delayed(const Duration(milliseconds: 1)); // STEP 3 await Future.delayed(const Duration(milliseconds: 1)); // STEP 3
print("done!"); // STEP 4 print("done!"); // STEP 4
} // STEP 5 } // STEP 5
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new MaterialApp( return MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
home: new Container(), home: Container(),
); );
} }
} }
......
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