Skip to content

Commit

Permalink
Remove new keyword in a few files (#104438)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsreichardt authored Jun 6, 2022
1 parent a939d9d commit 64db621
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion dev/benchmarks/microbenchmarks/lib/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/painting/text_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions packages/flutter/lib/src/widgets/platform_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ class AndroidView extends StatefulWidget {
/// child: AndroidView(
/// viewType: 'webview',
/// gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
/// new Factory<OneSequenceGestureRecognizer>(
/// () => new EagerGestureRecognizer(),
/// Factory<OneSequenceGestureRecognizer>(
/// () => EagerGestureRecognizer(),
/// ),
/// ].toSet(),
/// ),
Expand Down Expand Up @@ -284,8 +284,8 @@ class UiKitView extends StatefulWidget {
/// child: UiKitView(
/// viewType: 'webview',
/// gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
/// new Factory<OneSequenceGestureRecognizer>(
/// () => new EagerGestureRecognizer(),
/// Factory<OneSequenceGestureRecognizer>(
/// () => EagerGestureRecognizer(),
/// ),
/// ].toSet(),
/// ),
Expand Down Expand Up @@ -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(),
/// ),
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/preferred_size.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/widgets/sliver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/test/painting/colors_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_driver/lib/driver_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
///
/// main() {
/// enableFlutterDriverExtension();
/// runApp(new ExampleApp());
/// runApp(ExampleApp());
/// }
library flutter_driver_extension;

Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_driver/lib/src/common/enum_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_test/lib/src/nonconst.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand All @@ -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(),
);
}
}
Expand Down Expand Up @@ -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');
}
Expand All @@ -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(),
);
}
}
Expand Down Expand Up @@ -208,17 +208,17 @@ 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));
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
topLevelFunction();
return new MaterialApp( // BUILD BREAKPOINT
return MaterialApp( // BUILD BREAKPOINT
title: 'Flutter Demo',
home: new Container(),
home: Container(),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand All @@ -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(),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
);
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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(),
);
}
}
Expand Down

0 comments on commit 64db621

Please sign in to comment.