Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
64db6219
Unverified
Commit
64db6219
authored
Jun 06, 2022
by
Nils Reichardt
Committed by
GitHub
Jun 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `new` keyword in a few files (#104438)
parent
a939d9d7
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
47 additions
and
47 deletions
+47
-47
common.dart
dev/benchmarks/microbenchmarks/lib/common.dart
+1
-1
text_style.dart
packages/flutter/lib/src/painting/text_style.dart
+2
-2
platform_view.dart
packages/flutter/lib/src/widgets/platform_view.dart
+6
-6
preferred_size.dart
packages/flutter/lib/src/widgets/preferred_size.dart
+1
-1
sliver.dart
packages/flutter/lib/src/widgets/sliver.dart
+2
-2
colors_test.dart
packages/flutter/test/painting/colors_test.dart
+1
-1
driver_extension.dart
packages/flutter_driver/lib/driver_extension.dart
+1
-1
enum_util.dart
packages/flutter_driver/lib/src/common/enum_util.dart
+1
-1
cupertino_localizations.dart
...lutter_localizations/lib/src/cupertino_localizations.dart
+2
-2
material_localizations.dart
...flutter_localizations/lib/src/material_localizations.dart
+2
-2
nonconst.dart
packages/flutter_test/lib/src/nonconst.dart
+1
-1
basic_project.dart
...tools/test/integration.shard/test_data/basic_project.dart
+9
-9
deferred_components_project.dart
...egration.shard/test_data/deferred_components_project.dart
+3
-3
multidex_project.dart
...ls/test/integration.shard/test_data/multidex_project.dart
+2
-2
project_with_early_error.dart
...integration.shard/test_data/project_with_early_error.dart
+1
-1
stepping_project.dart
...ls/test/integration.shard/test_data/stepping_project.dart
+12
-12
No files found.
dev/benchmarks/microbenchmarks/lib/common.dart
View file @
64db6219
...
@@ -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,
...
...
packages/flutter/lib/src/painting/text_style.dart
View file @
64db6219
...
@@ -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
...
...
packages/flutter/lib/src/widgets/platform_view.dart
View file @
64db6219
...
@@ -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(),
/// ),
/// ),
...
...
packages/flutter/lib/src/widgets/preferred_size.dart
View file @
64db6219
...
@@ -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
;
}
}
...
...
packages/flutter/lib/src/widgets/sliver.dart
View file @
64db6219
...
@@ -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.
...
...
packages/flutter/test/painting/colors_test.dart
View file @
64db6219
...
@@ -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
),
...
...
packages/flutter_driver/lib/driver_extension.dart
View file @
64db6219
...
@@ -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
;
...
...
packages/flutter_driver/lib/src/common/enum_util.dart
View file @
64db6219
...
@@ -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
>
{
...
...
packages/flutter_localizations/lib/src/cupertino_localizations.dart
View file @
64db6219
...
@@ -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
...
...
packages/flutter_localizations/lib/src/material_localizations.dart
View file @
64db6219
...
@@ -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
...
...
packages/flutter_test/lib/src/nonconst.dart
View file @
64db6219
...
@@ -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);
...
...
packages/flutter_tools/test/integration.shard/test_data/basic_project.dart
View file @
64db6219
...
@@ -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(),
);
);
}
}
}
}
...
...
packages/flutter_tools/test/integration.shard/test_data/deferred_components_project.dart
View file @
64db6219
...
@@ -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(),
);
);
}
}
}
}
...
...
packages/flutter_tools/test/integration.shard/test_data/multidex_project.dart
View file @
64db6219
...
@@ -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(),
);
);
}
}
}
}
...
...
packages/flutter_tools/test/integration.shard/test_data/project_with_early_error.dart
View file @
64db6219
...
@@ -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));
}
}
}
}
...
...
packages/flutter_tools/test/integration.shard/test_data/stepping_project.dart
View file @
64db6219
...
@@ -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(),
);
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment