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