未验证 提交 2b1f9925 编写于 作者: D Dan Field 提交者: GitHub

new lints (#8849)

Dart lints added:
* Avoid optional new
* Avoid optional const
* Prefer single quotes
* Prefer default assignment `=`
上级 0c7a3f25
......@@ -100,7 +100,7 @@ linter:
- prefer_const_literals_to_create_immutables
# - prefer_constructors_over_static_methods # not yet tested
- prefer_contains
# - prefer_equal_for_default_values # not yet tested
- prefer_equal_for_default_values
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
# - prefer_final_fields # DIFFERENT FROM FLUTTER/FLUTTER
- prefer_final_locals
......@@ -118,15 +118,16 @@ linter:
- slash_for_doc_comments
# - sort_constructors_first # DIFFERENT FROM FLUTTER/FLUTTER
- sort_unnamed_constructors_first
- super_goes_last
- test_types_in_equals
- throw_in_finally
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
# - unawaited_futures # https://github.com/flutter/flutter/issues/5793
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
# - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_overrides
......
#!/bin/bash
echo "Analyzing dart:ui library..."
echo "Using analyzer from `which dartanalyzer`"
dartanalyzer --version
RESULTS=`dartanalyzer \
--options flutter/analysis_options.yaml \
"$1out/host_debug_unopt/gen/sky/bindings/dart_ui/ui.dart" \
2>&1 \
| grep -Ev "No issues found!" \
| grep -Ev "No issues found!" \
| grep -Ev "Analyzing.+out/host_debug_unopt/gen/sky/bindings/dart_ui/ui\.dart"`
echo "$RESULTS"
......
......@@ -2,9 +2,10 @@
set -ex
PATH="$HOME/depot_tools:$PATH"
cd ..
PATH=$(pwd)/third_party/dart/tools/sdks/dart-sdk/bin:$PATH
# Build the dart UI files
flutter/tools/gn --unoptimized
ninja -C out/host_debug_unopt generate_dart_ui
......
......@@ -3,6 +3,10 @@ set -e
shopt -s nullglob
echo "Verifying license script is still happy..."
echo "Using pub from `which pub`, dart from `which dart`"
dart --version
(cd flutter/tools/licenses; pub get; dart --enable-asserts lib/main.dart --src ../../.. --out ../../../out/license_script_output --golden ../../ci/licenses_golden)
for f in out/license_script_output/licenses_*; do
......
......@@ -76,7 +76,7 @@ void _maybeAddCreationLocationArgument(
}
final NamedExpression namedArgument =
new NamedExpression(_creationLocationParameterName, creationLocation);
NamedExpression(_creationLocationParameterName, creationLocation);
namedArgument.parent = arguments;
arguments.named.add(namedArgument);
}
......@@ -149,26 +149,26 @@ class _WidgetCallSiteTransformer extends Transformer {
Location location, {
String name,
ListLiteral parameterLocations,
bool showFile: true,
bool showFile = true,
}) {
final List<NamedExpression> arguments = <NamedExpression>[
new NamedExpression('line', new IntLiteral(location.line)),
new NamedExpression('column', new IntLiteral(location.column)),
NamedExpression('line', IntLiteral(location.line)),
NamedExpression('column', IntLiteral(location.column)),
];
if (showFile) {
arguments.add(new NamedExpression(
'file', new StringLiteral(location.file.toString())));
arguments.add(NamedExpression(
'file', StringLiteral(location.file.toString())));
}
if (name != null) {
arguments.add(new NamedExpression('name', new StringLiteral(name)));
arguments.add(NamedExpression('name', StringLiteral(name)));
}
if (parameterLocations != null) {
arguments
.add(new NamedExpression('parameterLocations', parameterLocations));
.add(NamedExpression('parameterLocations', parameterLocations));
}
return new ConstructorInvocation(
return ConstructorInvocation(
_locationClass.constructors.first,
new Arguments(<Expression>[], named: arguments),
Arguments(<Expression>[], named: arguments),
isConst: true,
);
}
......@@ -243,7 +243,7 @@ class _WidgetCallSiteTransformer extends Transformer {
_creationLocationParameterName,
);
if (creationLocationParameter != null) {
return new VariableGet(creationLocationParameter);
return VariableGet(creationLocationParameter);
}
}
......@@ -270,7 +270,7 @@ class _WidgetCallSiteTransformer extends Transformer {
}
return _constructLocation(
location,
parameterLocations: new ListLiteral(
parameterLocations: ListLiteral(
parameterLocations,
typeArgument: _locationClass.thisType,
isConst: true,
......@@ -342,12 +342,12 @@ class WidgetCreatorTracker implements ProgramTransformer {
return;
}
clazz.implementedTypes
.add(new Supertype(_hasCreationLocationClass, <DartType>[]));
.add(Supertype(_hasCreationLocationClass, <DartType>[]));
// We intentionally use the library context of the _HasCreationLocation
// class for the private field even if [clazz] is in a different library
// so that all classes implementing Widget behave consistently.
final Field locationField = new Field(
new Name(
final Field locationField = Field(
Name(
_locationFieldName,
_hasCreationLocationClass.enclosingLibrary,
),
......@@ -356,7 +356,7 @@ class WidgetCreatorTracker implements ProgramTransformer {
clazz.addMember(locationField);
final Set<Constructor> _handledConstructors =
new Set<Constructor>.identity();
Set<Constructor>.identity();
void handleConstructor(Constructor constructor) {
if (!_handledConstructors.add(constructor)) {
......@@ -366,7 +366,7 @@ class WidgetCreatorTracker implements ProgramTransformer {
constructor.function,
_creationLocationParameterName,
));
final VariableDeclaration variable = new VariableDeclaration(
final VariableDeclaration variable = VariableDeclaration(
_creationLocationParameterName,
type: _locationClass.thisType,
);
......@@ -386,7 +386,7 @@ class WidgetCreatorTracker implements ProgramTransformer {
_maybeAddCreationLocationArgument(
initializer.arguments,
initializer.target.function,
new VariableGet(variable),
VariableGet(variable),
_locationClass,
);
hasRedirectingInitializer = true;
......@@ -394,9 +394,9 @@ class WidgetCreatorTracker implements ProgramTransformer {
}
}
if (!hasRedirectingInitializer) {
constructor.initializers.add(new FieldInitializer(
constructor.initializers.add(FieldInitializer(
locationField,
new VariableGet(variable),
VariableGet(variable),
));
// TODO(jacobr): add an assert verifying the locationField is not
// null. Currently, we cannot safely add this assert because we do not
......@@ -405,9 +405,9 @@ class WidgetCreatorTracker implements ProgramTransformer {
// arguments but it is possible users could add classes with optional
// positional arguments.
//
// constructor.initializers.add(new AssertInitializer(new AssertStatement(
// new IsExpression(
// new VariableGet(variable), _locationClass.thisType),
// constructor.initializers.add(AssertInitializer(AssertStatement(
// IsExpression(
// VariableGet(variable), _locationClass.thisType),
// conditionStartOffset: constructor.fileOffset,
// conditionEndOffset: constructor.fileOffset,
// )));
......@@ -434,7 +434,7 @@ class WidgetCreatorTracker implements ProgramTransformer {
}
}
}
return new Component()..libraries.addAll(libraries);
return Component()..libraries.addAll(libraries);
}
/// Transform the given [program].
......@@ -459,13 +459,13 @@ class WidgetCreatorTracker implements ProgramTransformer {
// TODO(jacobr): once there is a working incremental ClassHierarchy
// constructor switch to using it instead of building a ClassHierarchy off
// the full program.
hierarchy = new ClassHierarchy(
hierarchy = ClassHierarchy(
_computeFullProgram(program),
onAmbiguousSupertypes: (Class cls, Supertype a, Supertype b) { },
);
final Set<Class> transformedClasses = new Set<Class>.identity();
final Set<Library> librariesToTransform = new Set<Library>.identity()
final Set<Class> transformedClasses = Set<Class>.identity();
final Set<Library> librariesToTransform = Set<Library>.identity()
..addAll(libraries);
for (Library library in libraries) {
......@@ -483,7 +483,7 @@ class WidgetCreatorTracker implements ProgramTransformer {
// Transform call sites to pass the location parameter.
final _WidgetCallSiteTransformer callsiteTransformer =
new _WidgetCallSiteTransformer(
_WidgetCallSiteTransformer(
hierarchy,
widgetClass: _widgetClass,
locationClass: _locationClass,
......@@ -528,7 +528,7 @@ class WidgetCreatorTracker implements ProgramTransformer {
if (procedure.isFactory) {
_maybeAddNamedParameter(
procedure.function,
new VariableDeclaration(
VariableDeclaration(
_creationLocationParameterName,
type: _locationClass.thisType,
),
......@@ -544,14 +544,14 @@ class WidgetCreatorTracker implements ProgramTransformer {
}
final Set<Constructor> _handledConstructors =
new Set<Constructor>.identity();
Set<Constructor>.identity();
void handleConstructor(Constructor constructor) {
if (!_handledConstructors.add(constructor)) {
return;
}
final VariableDeclaration variable = new VariableDeclaration(
final VariableDeclaration variable = VariableDeclaration(
_creationLocationParameterName,
type: _locationClass.thisType,
);
......@@ -575,7 +575,7 @@ class WidgetCreatorTracker implements ProgramTransformer {
_maybeAddCreationLocationArgument(
initializer.arguments,
initializer.target.function,
new VariableGet(variable),
VariableGet(variable),
_locationClass,
);
} else if (initializer is SuperInitializer &&
......@@ -583,7 +583,7 @@ class WidgetCreatorTracker implements ProgramTransformer {
_maybeAddCreationLocationArgument(
initializer.arguments,
initializer.target.function,
new VariableGet(variable),
VariableGet(variable),
_locationClass,
);
}
......
......@@ -21,9 +21,9 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface{
final frontend.CompilerInterface _compiler;
_FlutterFrontendCompiler(StringSink output,
{bool trackWidgetCreation: false, bool unsafePackageSerialization}) :
_compiler = new frontend.FrontendCompiler(output,
transformer: trackWidgetCreation ? new WidgetCreatorTracker() : null,
{bool trackWidgetCreation = false, bool unsafePackageSerialization}) :
_compiler = frontend.FrontendCompiler(output,
transformer: trackWidgetCreation ? WidgetCreatorTracker() : null,
unsafePackageSerialization: unsafePackageSerialization);
@override
......@@ -108,7 +108,7 @@ Future<int> starter(
'--sdk-root=$sdkRoot',
'--output-dill=$outputTrainingDill',
'--target=flutter']);
compiler ??= new _FlutterFrontendCompiler(output, trackWidgetCreation: true);
compiler ??= _FlutterFrontendCompiler(output, trackWidgetCreation: true);
await compiler.compile(Platform.script.toFilePath(), options);
compiler.acceptLastDelta();
......@@ -125,7 +125,7 @@ Future<int> starter(
}
}
compiler ??= new _FlutterFrontendCompiler(output,
compiler ??= _FlutterFrontendCompiler(output,
trackWidgetCreation: options['track-widget-creation'],
unsafePackageSerialization: options['unsafe-package-serialization']);
......@@ -133,7 +133,7 @@ Future<int> starter(
return await compiler.compile(options.rest[0], options) ? 0 : 254;
}
final Completer<int> completer = new Completer<int>();
final Completer<int> completer = Completer<int>();
frontend.listenAndCompile(compiler, input ?? stdin, options, completer);
return completer.future;
}
......@@ -9,7 +9,7 @@ class _MockedCompiler extends Mock implements frontend.CompilerInterface {}
Future<int> main() async {
group('basic', () {
final frontend.CompilerInterface compiler = new _MockedCompiler();
final frontend.CompilerInterface compiler = _MockedCompiler();
test('train with mocked compiler completes', () async {
expect(await starter(<String>['--train'], compiler: compiler), equals(0));
......
......@@ -24,7 +24,7 @@ class Scene extends NativeFieldWrapperClass2 {
/// This is a slow operation that is performed on a background thread.
Future<Image> toImage(int width, int height) {
if (width <= 0 || height <= 0)
throw new Exception('Invalid image dimensions.');
throw Exception('Invalid image dimensions.');
return _futurize(
(_Callback<Image> callback) => _toImage(width, height, callback)
);
......@@ -242,7 +242,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
/// Adds a [Picture] to the scene.
///
/// The picture is rasterized at the given offset.
void addPicture(Offset offset, Picture picture, { bool isComplexHint: false, bool willChangeHint: false }) {
void addPicture(Offset offset, Picture picture, { bool isComplexHint = false, bool willChangeHint = false }) {
int hints = 0;
if (isComplexHint)
hints |= 1;
......@@ -263,7 +263,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
/// previous or new size, to workaround this the framework "freezes" the
/// texture just before resizing the Android view and un-freezes it when it is
/// certain that a frame with the new size is ready.
void addTexture(int textureId, { Offset offset: Offset.zero, double width: 0.0, double height: 0.0 , bool freeze: false}) {
void addTexture(int textureId, { Offset offset = Offset.zero, double width = 0.0, double height = 0.0 , bool freeze = false}) {
assert(offset != null, 'Offset argument was null');
_addTexture(offset.dx, offset.dy, width, height, textureId, freeze);
}
......@@ -285,7 +285,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
/// With a platform view in the scene, Quartz has to composite the two Flutter surfaces and the
/// embedded UIView. In addition to that, on iOS versions greater than 9, the Flutter frames are
/// synchronized with the UIView frames adding additional performance overhead.
void addPlatformView(int viewId, { Offset offset: Offset.zero, double width: 0.0, double height: 0.0}) {
void addPlatformView(int viewId, { Offset offset = Offset.zero, double width = 0.0, double height = 0.0}) {
assert(offset != null, 'Offset argument was null');
_addPlatformView(offset.dx, offset.dy, width, height, viewId);
}
......@@ -294,11 +294,11 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
/// (Fuchsia-only) Adds a scene rendered by another application to the scene
/// for this application.
void addChildScene({
Offset offset: Offset.zero,
double width: 0.0,
double height: 0.0,
Offset offset = Offset.zero,
double width = 0.0,
double height = 0.0,
SceneHost sceneHost,
bool hitTestable: true
bool hitTestable = true
}) {
_addChildScene(offset.dx,
offset.dy,
......
此差异已折叠。
......@@ -5,7 +5,7 @@
part of dart.ui;
class _HashEnd { const _HashEnd(); }
const _HashEnd _hashEnd = const _HashEnd();
const _HashEnd _hashEnd = _HashEnd();
/// Jenkins hash function, optimized for small integers.
//
......
......@@ -31,13 +31,13 @@ void _updateWindowMetrics(double devicePixelRatio,
double viewInsetLeft) {
window
.._devicePixelRatio = devicePixelRatio
.._physicalSize = new Size(width, height)
.._padding = new WindowPadding._(
.._physicalSize = Size(width, height)
.._padding = WindowPadding._(
top: paddingTop,
right: paddingRight,
bottom: paddingBottom,
left: paddingLeft)
.._viewInsets = new WindowPadding._(
.._viewInsets = WindowPadding._(
top: viewInsetTop,
right: viewInsetRight,
bottom: viewInsetBottom,
......@@ -63,12 +63,12 @@ _LocaleClosure _getLocaleClosure() => _localeClosure;
void _updateLocales(List<String> locales) {
const int stringsPerLocale = 4;
final int numLocales = locales.length ~/ stringsPerLocale;
window._locales = new List<Locale>(numLocales);
window._locales = List<Locale>(numLocales);
for (int localeIndex = 0; localeIndex < numLocales; localeIndex++) {
final String countryCode = locales[localeIndex * stringsPerLocale + 1];
final String scriptCode = locales[localeIndex * stringsPerLocale + 2];
window._locales[localeIndex] = new Locale.fromSubtags(
window._locales[localeIndex] = Locale.fromSubtags(
languageCode: locales[localeIndex * stringsPerLocale],
countryCode: countryCode.isEmpty ? null : countryCode,
scriptCode: scriptCode.isEmpty ? null : scriptCode,
......@@ -123,7 +123,7 @@ void _updateSemanticsEnabled(bool enabled) {
@pragma('vm:entry-point')
// ignore: unused_element
void _updateAccessibilityFeatures(int values) {
final AccessibilityFeatures newFeatures = new AccessibilityFeatures._(values);
final AccessibilityFeatures newFeatures = AccessibilityFeatures._(values);
if (newFeatures == window._accessibilityFeatures)
return;
window._accessibilityFeatures = newFeatures;
......@@ -169,7 +169,7 @@ void _dispatchSemanticsAction(int id, int action, ByteData args) {
@pragma('vm:entry-point')
// ignore: unused_element
void _beginFrame(int microseconds) {
_invoke1<Duration>(window.onBeginFrame, window._onBeginFrameZone, new Duration(microseconds: microseconds));
_invoke1<Duration>(window.onBeginFrame, window._onBeginFrameZone, Duration(microseconds: microseconds));
}
@pragma('vm:entry-point')
......@@ -277,11 +277,11 @@ PointerDataPacket _unpackPointerDataPacket(ByteData packet) {
const int kBytesPerPointerData = _kPointerDataFieldCount * kStride;
final int length = packet.lengthInBytes ~/ kBytesPerPointerData;
assert(length * kBytesPerPointerData == packet.lengthInBytes);
final List<PointerData> data = new List<PointerData>(length);
final List<PointerData> data = List<PointerData>(length);
for (int i = 0; i < length; ++i) {
int offset = i * _kPointerDataFieldCount;
data[i] = new PointerData(
timeStamp: new Duration(microseconds: packet.getInt64(kStride * offset++, _kFakeHostEndian)),
data[i] = PointerData(
timeStamp: Duration(microseconds: packet.getInt64(kStride * offset++, _kFakeHostEndian)),
change: PointerChange.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)],
kind: PointerDeviceKind.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)],
signalKind: PointerSignalKind.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)],
......@@ -308,5 +308,5 @@ PointerDataPacket _unpackPointerDataPacket(ByteData packet) {
);
assert(offset == (i + 1) * _kPointerDataFieldCount);
}
return new PointerDataPacket(data: data);
return PointerDataPacket(data: data);
}
......@@ -24,7 +24,7 @@ Future<developer.ServiceExtensionResponse> _scheduleFrame(
// Schedule the frame.
window.scheduleFrame();
// Always succeed.
return new developer.ServiceExtensionResponse.result(json.encode(<String, String>{
return developer.ServiceExtensionResponse.result(json.encode(<String, String>{
'type': 'Success',
}));
}
......
此差异已折叠。
......@@ -62,7 +62,7 @@ class PluginUtilities {
assert(callback != null, "'callback' must not be null.");
return _forwardCache.putIfAbsent(callback, () {
final int handle = _getCallbackHandle(callback);
return handle != null ? new CallbackHandle.fromRawHandle(handle) : null;
return handle != null ? CallbackHandle.fromRawHandle(handle) : null;
});
}
......
......@@ -70,30 +70,30 @@ enum PointerSignalKind {
class PointerData {
/// Creates an object that represents the state of a pointer.
const PointerData({
this.timeStamp: Duration.zero,
this.change: PointerChange.cancel,
this.kind: PointerDeviceKind.touch,
this.timeStamp = Duration.zero,
this.change = PointerChange.cancel,
this.kind = PointerDeviceKind.touch,
this.signalKind,
this.device: 0,
this.physicalX: 0.0,
this.physicalY: 0.0,
this.buttons: 0,
this.obscured: false,
this.pressure: 0.0,
this.pressureMin: 0.0,
this.pressureMax: 0.0,
this.distance: 0.0,
this.distanceMax: 0.0,
this.size: 0.0,
this.radiusMajor: 0.0,
this.radiusMinor: 0.0,
this.radiusMin: 0.0,
this.radiusMax: 0.0,
this.orientation: 0.0,
this.tilt: 0.0,
this.platformData: 0,
this.scrollDeltaX: 0.0,
this.scrollDeltaY: 0.0,
this.device = 0,
this.physicalX = 0.0,
this.physicalY = 0.0,
this.buttons = 0,
this.obscured = false,
this.pressure = 0.0,
this.pressureMin = 0.0,
this.pressureMax = 0.0,
this.distance = 0.0,
this.distanceMax = 0.0,
this.size = 0.0,
this.radiusMajor = 0.0,
this.radiusMinor = 0.0,
this.radiusMin = 0.0,
this.radiusMax = 0.0,
this.orientation = 0.0,
this.tilt = 0.0,
this.platformData = 0,
this.scrollDeltaX = 0.0,
this.scrollDeltaY = 0.0,
});
/// Time of event dispatch, relative to an arbitrary timeline.
......@@ -267,7 +267,7 @@ class PointerData {
/// A sequence of reports about the state of pointers.
class PointerDataPacket {
/// Creates a packet of pointer data reports.
const PointerDataPacket({ this.data: const <PointerData>[] });
const PointerDataPacket({ this.data = const <PointerData>[] });
/// Data about the individual pointers in this packet.
///
......
......@@ -42,55 +42,55 @@ class SemanticsAction {
/// The equivalent of a user briefly tapping the screen with the finger
/// without moving it.
static const SemanticsAction tap = const SemanticsAction._(_kTapIndex);
static const SemanticsAction tap = SemanticsAction._(_kTapIndex);
/// The equivalent of a user pressing and holding the screen with the finger
/// for a few seconds without moving it.
static const SemanticsAction longPress = const SemanticsAction._(_kLongPressIndex);
static const SemanticsAction longPress = SemanticsAction._(_kLongPressIndex);
/// The equivalent of a user moving their finger across the screen from right
/// to left.
///
/// This action should be recognized by controls that are horizontally
/// scrollable.
static const SemanticsAction scrollLeft = const SemanticsAction._(_kScrollLeftIndex);
static const SemanticsAction scrollLeft = SemanticsAction._(_kScrollLeftIndex);
/// The equivalent of a user moving their finger across the screen from left
/// to right.
///
/// This action should be recognized by controls that are horizontally
/// scrollable.
static const SemanticsAction scrollRight = const SemanticsAction._(_kScrollRightIndex);
static const SemanticsAction scrollRight = SemanticsAction._(_kScrollRightIndex);
/// The equivalent of a user moving their finger across the screen from
/// bottom to top.
///
/// This action should be recognized by controls that are vertically
/// scrollable.
static const SemanticsAction scrollUp = const SemanticsAction._(_kScrollUpIndex);
static const SemanticsAction scrollUp = SemanticsAction._(_kScrollUpIndex);
/// The equivalent of a user moving their finger across the screen from top
/// to bottom.
///
/// This action should be recognized by controls that are vertically
/// scrollable.
static const SemanticsAction scrollDown = const SemanticsAction._(_kScrollDownIndex);
static const SemanticsAction scrollDown = SemanticsAction._(_kScrollDownIndex);
/// A request to increase the value represented by the semantics node.
///
/// For example, this action might be recognized by a slider control.
static const SemanticsAction increase = const SemanticsAction._(_kIncreaseIndex);
static const SemanticsAction increase = SemanticsAction._(_kIncreaseIndex);
/// A request to decrease the value represented by the semantics node.
///
/// For example, this action might be recognized by a slider control.
static const SemanticsAction decrease = const SemanticsAction._(_kDecreaseIndex);
static const SemanticsAction decrease = SemanticsAction._(_kDecreaseIndex);
/// A request to fully show the semantics node on screen.
///
/// For example, this action might be send to a node in a scrollable list that
/// is partially off screen to bring it on screen.
static const SemanticsAction showOnScreen = const SemanticsAction._(_kShowOnScreenIndex);
static const SemanticsAction showOnScreen = SemanticsAction._(_kShowOnScreenIndex);
/// Move the cursor forward by one character.
///
......@@ -98,7 +98,7 @@ class SemanticsAction {
///
/// The action includes a boolean argument, which indicates whether the cursor
/// movement should extend (or start) a selection.
static const SemanticsAction moveCursorForwardByCharacter = const SemanticsAction._(_kMoveCursorForwardByCharacterIndex);
static const SemanticsAction moveCursorForwardByCharacter = SemanticsAction._(_kMoveCursorForwardByCharacterIndex);
/// Move the cursor backward by one character.
///
......@@ -106,7 +106,7 @@ class SemanticsAction {
///
/// The action includes a boolean argument, which indicates whether the cursor
/// movement should extend (or start) a selection.
static const SemanticsAction moveCursorBackwardByCharacter = const SemanticsAction._(_kMoveCursorBackwardByCharacterIndex);
static const SemanticsAction moveCursorBackwardByCharacter = SemanticsAction._(_kMoveCursorBackwardByCharacterIndex);
/// Set the text selection to the given range.
///
......@@ -117,16 +117,16 @@ class SemanticsAction {
///
/// Setting `base` and `extent` to the same value will move the cursor to
/// that position (without selecting anything).
static const SemanticsAction setSelection = const SemanticsAction._(_kSetSelectionIndex);
static const SemanticsAction setSelection = SemanticsAction._(_kSetSelectionIndex);
/// Copy the current selection to the clipboard.
static const SemanticsAction copy = const SemanticsAction._(_kCopyIndex);
static const SemanticsAction copy = SemanticsAction._(_kCopyIndex);
/// Cut the current selection and place it in the clipboard.
static const SemanticsAction cut = const SemanticsAction._(_kCutIndex);
static const SemanticsAction cut = SemanticsAction._(_kCutIndex);
/// Paste the current content of the clipboard.
static const SemanticsAction paste = const SemanticsAction._(_kPasteIndex);
static const SemanticsAction paste = SemanticsAction._(_kPasteIndex);
/// Indicates that the node has gained accessibility focus.
///
......@@ -139,7 +139,7 @@ class SemanticsAction {
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
static const SemanticsAction didGainAccessibilityFocus = const SemanticsAction._(_kDidGainAccessibilityFocusIndex);
static const SemanticsAction didGainAccessibilityFocus = SemanticsAction._(_kDidGainAccessibilityFocusIndex);
/// Indicates that the node has lost accessibility focus.
///
......@@ -152,13 +152,13 @@ class SemanticsAction {
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
static const SemanticsAction didLoseAccessibilityFocus = const SemanticsAction._(_kDidLoseAccessibilityFocusIndex);
static const SemanticsAction didLoseAccessibilityFocus = SemanticsAction._(_kDidLoseAccessibilityFocusIndex);
/// Indicates that the user has invoked a custom accessibility action.
///
/// This handler is added automatically whenever a custom accessibility
/// action is added to a semantics node.
static const SemanticsAction customAction = const SemanticsAction._(_kCustomAction);
static const SemanticsAction customAction = SemanticsAction._(_kCustomAction);
/// A request that the node should be dismissed.
///
......@@ -167,7 +167,7 @@ class SemanticsAction {
/// (with TalkBack) special hint text is spoken when focusing the node and
/// a custom action is available in the local context menu. On iOS,
/// (with VoiceOver) users can perform a standard gesture to dismiss it.
static const SemanticsAction dismiss = const SemanticsAction._(_kDismissIndex);
static const SemanticsAction dismiss = SemanticsAction._(_kDismissIndex);
/// Move the cursor forward by one word.
///
......@@ -175,7 +175,7 @@ class SemanticsAction {
///
/// The action includes a boolean argument, which indicates whether the cursor
/// movement should extend (or start) a selection.
static const SemanticsAction moveCursorForwardByWord = const SemanticsAction._(_kMoveCursorForwardByWordIndex);
static const SemanticsAction moveCursorForwardByWord = SemanticsAction._(_kMoveCursorForwardByWordIndex);
/// Move the cursor backward by one word.
///
......@@ -183,13 +183,13 @@ class SemanticsAction {
///
/// The action includes a boolean argument, which indicates whether the cursor
/// movement should extend (or start) a selection.
static const SemanticsAction moveCursorBackwardByWord = const SemanticsAction._(_kMoveCursorBackwardByWordIndex);
static const SemanticsAction moveCursorBackwardByWord = SemanticsAction._(_kMoveCursorBackwardByWordIndex);
/// The possible semantics actions.
///
/// The map's key is the [index] of the action and the value is the action
/// itself.
static const Map<int, SemanticsAction> values = const <int, SemanticsAction>{
static const Map<int, SemanticsAction> values = <int, SemanticsAction>{
_kTapIndex: tap,
_kLongPressIndex: longPress,
_kScrollLeftIndex: scrollLeft,
......@@ -305,7 +305,7 @@ class SemanticsFlag {
/// See also:
///
/// * [SemanticsFlag.isChecked], which controls whether the node is "checked" or "unchecked".
static const SemanticsFlag hasCheckedState = const SemanticsFlag._(_kHasCheckedStateIndex);
static const SemanticsFlag hasCheckedState = SemanticsFlag._(_kHasCheckedStateIndex);
/// Whether a semantics node that [hasCheckedState] is checked.
///
......@@ -317,7 +317,7 @@ class SemanticsFlag {
/// See also:
///
/// * [SemanticsFlag.hasCheckedState], which enables a checked state.
static const SemanticsFlag isChecked = const SemanticsFlag._(_kIsCheckedIndex);
static const SemanticsFlag isChecked = SemanticsFlag._(_kIsCheckedIndex);
/// Whether a semantics node is selected.
......@@ -326,25 +326,25 @@ class SemanticsFlag {
/// "unselected".
///
/// For example, the active tab in a tab bar has [isSelected] set to true.
static const SemanticsFlag isSelected = const SemanticsFlag._(_kIsSelectedIndex);
static const SemanticsFlag isSelected = SemanticsFlag._(_kIsSelectedIndex);
/// Whether the semantic node represents a button.
///
/// Platforms has special handling for buttons, for example Android's TalkBack
/// and iOS's VoiceOver provides an additional hint when the focused object is
/// a button.
static const SemanticsFlag isButton = const SemanticsFlag._(_kIsButtonIndex);
static const SemanticsFlag isButton = SemanticsFlag._(_kIsButtonIndex);
/// Whether the semantic node represents a text field.
///
/// Text fields are announced as such and allow text input via accessibility
/// affordances.
static const SemanticsFlag isTextField = const SemanticsFlag._(_kIsTextFieldIndex);
static const SemanticsFlag isTextField = SemanticsFlag._(_kIsTextFieldIndex);
/// Whether the semantic node currently holds the user's focus.
///
/// The focused element is usually the current receiver of keyboard inputs.
static const SemanticsFlag isFocused = const SemanticsFlag._(_kIsFocusedIndex);
static const SemanticsFlag isFocused = SemanticsFlag._(_kIsFocusedIndex);
/// The semantics node has the quality of either being "enabled" or
/// "disabled".
......@@ -352,33 +352,33 @@ class SemanticsFlag {
/// For example, a button can be enabled or disabled and therefore has an
/// "enabled" state. Static text is usually neither enabled nor disabled and
/// therefore does not have an "enabled" state.
static const SemanticsFlag hasEnabledState = const SemanticsFlag._(_kHasEnabledStateIndex);
static const SemanticsFlag hasEnabledState = SemanticsFlag._(_kHasEnabledStateIndex);
/// Whether a semantic node that [hasEnabledState] is currently enabled.
///
/// A disabled element does not respond to user interaction. For example, a
/// button that currently does not respond to user interaction should be
/// marked as disabled.
static const SemanticsFlag isEnabled = const SemanticsFlag._(_kIsEnabledIndex);
static const SemanticsFlag isEnabled = SemanticsFlag._(_kIsEnabledIndex);
/// Whether a semantic node is in a mutually exclusive group.
///
/// For example, a radio button is in a mutually exclusive group because
/// only one radio button in that group can be marked as [isChecked].
static const SemanticsFlag isInMutuallyExclusiveGroup = const SemanticsFlag._(_kIsInMutuallyExclusiveGroupIndex);
static const SemanticsFlag isInMutuallyExclusiveGroup = SemanticsFlag._(_kIsInMutuallyExclusiveGroupIndex);
/// Whether a semantic node is a header that divides content into sections.
///
/// For example, headers can be used to divide a list of alphabetically
/// sorted words into the sections A, B, C, etc. as can be found in many
/// address book applications.
static const SemanticsFlag isHeader = const SemanticsFlag._(_kIsHeaderIndex);
static const SemanticsFlag isHeader = SemanticsFlag._(_kIsHeaderIndex);
/// Whether the value of the semantics node is obscured.
///
/// This is usually used for text fields to indicate that its content
/// is a password or contains other sensitive information.
static const SemanticsFlag isObscured = const SemanticsFlag._(_kIsObscuredIndex);
static const SemanticsFlag isObscured = SemanticsFlag._(_kIsObscuredIndex);
/// Whether the semantics node is the root of a subtree for which a route name
/// should be announced.
......@@ -403,7 +403,7 @@ class SemanticsFlag {
///
/// This is used in widgets such as Routes, Drawers, and Dialogs to
/// communicate significant changes in the visible screen.
static const SemanticsFlag scopesRoute = const SemanticsFlag._(_kScopesRouteIndex);
static const SemanticsFlag scopesRoute = SemanticsFlag._(_kScopesRouteIndex);
/// Whether the semantics node label is the name of a visually distinct
/// route.
......@@ -416,7 +416,7 @@ class SemanticsFlag {
///
/// Updating this label within the same active route subtree will not cause
/// additional announcements.
static const SemanticsFlag namesRoute = const SemanticsFlag._(_kNamesRouteIndex);
static const SemanticsFlag namesRoute = SemanticsFlag._(_kNamesRouteIndex);
/// Whether the semantics node is considered hidden.
///
......@@ -434,13 +434,13 @@ class SemanticsFlag {
/// the semantics tree altogether. Hidden elements are only included in the
/// semantics tree to work around platform limitations and they are mainly
/// used to implement accessibility scrolling on iOS.
static const SemanticsFlag isHidden = const SemanticsFlag._(_kIsHiddenIndex);
static const SemanticsFlag isHidden = SemanticsFlag._(_kIsHiddenIndex);
/// Whether the semantics node represents an image.
///
/// Both TalkBack and VoiceOver will inform the user the the semantics node
/// represents an image.
static const SemanticsFlag isImage = const SemanticsFlag._(_kIsImageIndex);
static const SemanticsFlag isImage = SemanticsFlag._(_kIsImageIndex);
/// Whether the semantics node is a live region.
///
......@@ -451,7 +451,7 @@ class SemanticsFlag {
/// An example of a live region is a [SnackBar] widget. On Android, A live
/// region causes a polite announcement to be generated automatically, even
/// if the user does not have focus of the widget.
static const SemanticsFlag isLiveRegion = const SemanticsFlag._(_kIsLiveRegionIndex);
static const SemanticsFlag isLiveRegion = SemanticsFlag._(_kIsLiveRegionIndex);
/// The semantics node has the quality of either being "on" or "off".
///
......@@ -462,7 +462,7 @@ class SemanticsFlag {
/// See also:
///
/// * [SemanticsFlag.isToggled], which controls whether the node is "on" or "off".
static const SemanticsFlag hasToggledState = const SemanticsFlag._(_kHasToggledStateIndex);
static const SemanticsFlag hasToggledState = SemanticsFlag._(_kHasToggledStateIndex);
/// If true, the semantics node is "on". If false, the semantics node is
/// "off".
......@@ -472,7 +472,7 @@ class SemanticsFlag {
/// See also:
///
/// * [SemanticsFlag.hasToggledState], which enables a toggled state.
static const SemanticsFlag isToggled = const SemanticsFlag._(_kIsToggledIndex);
static const SemanticsFlag isToggled = SemanticsFlag._(_kIsToggledIndex);
/// Whether the platform can scroll the semantics node when the user attempts
/// to move focus to an offscreen child.
......@@ -481,12 +481,12 @@ class SemanticsFlag {
/// easily move the accessibility focus to the next set of children. A
/// [PageView] widget does not have implicit scrolling, so that users don't
/// navigate to the next page when reaching the end of the current one.
static const SemanticsFlag hasImplicitScrolling = const SemanticsFlag._(_kHasImplicitScrollingIndex);
static const SemanticsFlag hasImplicitScrolling = SemanticsFlag._(_kHasImplicitScrollingIndex);
/// The possible semantics flags.
///
/// The map's key is the [index] of the flag and the value is the flag itself.
static const Map<int, SemanticsFlag> values = const <int, SemanticsFlag>{
static const Map<int, SemanticsFlag> values = <int, SemanticsFlag>{
_kHasCheckedStateIndex: hasCheckedState,
_kIsCheckedIndex: isChecked,
_kIsSelectedIndex: isSelected,
......
......@@ -21,31 +21,31 @@ class FontWeight {
final int index;
/// Thin, the least thick
static const FontWeight w100 = const FontWeight._(0);
static const FontWeight w100 = FontWeight._(0);
/// Extra-light
static const FontWeight w200 = const FontWeight._(1);
static const FontWeight w200 = FontWeight._(1);
/// Light
static const FontWeight w300 = const FontWeight._(2);
static const FontWeight w300 = FontWeight._(2);
/// Normal / regular / plain
static const FontWeight w400 = const FontWeight._(3);
static const FontWeight w400 = FontWeight._(3);
/// Medium
static const FontWeight w500 = const FontWeight._(4);
static const FontWeight w500 = FontWeight._(4);
/// Semi-bold
static const FontWeight w600 = const FontWeight._(5);
static const FontWeight w600 = FontWeight._(5);
/// Bold
static const FontWeight w700 = const FontWeight._(6);
static const FontWeight w700 = FontWeight._(6);
/// Extra-bold
static const FontWeight w800 = const FontWeight._(7);
static const FontWeight w800 = FontWeight._(7);
/// Black, the most thick
static const FontWeight w900 = const FontWeight._(8);
static const FontWeight w900 = FontWeight._(8);
/// The default font weight.
static const FontWeight normal = w400;
......@@ -54,7 +54,7 @@ class FontWeight {
static const FontWeight bold = w700;
/// A list of all the font weights.
static const List<FontWeight> values = const <FontWeight>[
static const List<FontWeight> values = <FontWeight>[
w100, w200, w300, w400, w500, w600, w700, w800, w900
];
......@@ -153,7 +153,7 @@ class TextDecoration {
int mask = 0;
for (TextDecoration decoration in decorations)
mask |= decoration._mask;
return new TextDecoration._(mask);
return TextDecoration._(mask);
}
final int _mask;
......@@ -164,16 +164,16 @@ class TextDecoration {
}
/// Do not draw a decoration
static const TextDecoration none = const TextDecoration._(0x0);
static const TextDecoration none = TextDecoration._(0x0);
/// Draw a line underneath each line of text
static const TextDecoration underline = const TextDecoration._(0x1);
static const TextDecoration underline = TextDecoration._(0x1);
/// Draw a line above each line of text
static const TextDecoration overline = const TextDecoration._(0x2);
static const TextDecoration overline = TextDecoration._(0x2);
/// Draw a line through each line of text
static const TextDecoration lineThrough = const TextDecoration._(0x4);
static const TextDecoration lineThrough = TextDecoration._(0x4);
@override
bool operator ==(dynamic other) {
......@@ -283,7 +283,7 @@ Int32List _encodeTextStyle(
Paint foreground,
List<Shadow> shadows
) {
final Int32List result = new Int32List(8);
final Int32List result = Int32List(8);
if (color != null) {
result[0] |= 1 << 1;
result[1] = color.value;
......@@ -408,7 +408,7 @@ class TextStyle {
List<Shadow> shadows,
}) : assert(color == null || foreground == null,
'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".'
),
_encoded = _encodeTextStyle(
color,
......@@ -489,9 +489,9 @@ class TextStyle {
@override
String toString() {
return 'TextStyle('
'color: ${ _encoded[0] & 0x00002 == 0x00002 ? new Color(_encoded[1]) : "unspecified"}, '
'decoration: ${ _encoded[0] & 0x00004 == 0x00004 ? new TextDecoration._(_encoded[2]) : "unspecified"}, '
'decorationColor: ${ _encoded[0] & 0x00008 == 0x00008 ? new Color(_encoded[3]) : "unspecified"}, '
'color: ${ _encoded[0] & 0x00002 == 0x00002 ? Color(_encoded[1]) : "unspecified"}, '
'decoration: ${ _encoded[0] & 0x00004 == 0x00004 ? TextDecoration._(_encoded[2]) : "unspecified"}, '
'decorationColor: ${ _encoded[0] & 0x00008 == 0x00008 ? Color(_encoded[3]) : "unspecified"}, '
'decorationStyle: ${ _encoded[0] & 0x00010 == 0x00010 ? TextDecorationStyle.values[_encoded[4]] : "unspecified"}, '
// The decorationThickness is not in encoded order in order to keep it near the other decoration properties.
'decorationThickness: ${_encoded[0] & 0x00100 == 0x00100 ? _decorationThickness : "unspecified"}, '
......@@ -547,7 +547,7 @@ Int32List _encodeParagraphStyle(
String ellipsis,
Locale locale,
) {
final Int32List result = new Int32List(6); // also update paragraph_builder.cc
final Int32List result = Int32List(6); // also update paragraph_builder.cc
if (textAlign != null) {
result[0] |= 1 << 1;
result[1] = textAlign.index;
......@@ -1028,7 +1028,7 @@ class TextBox {
final TextDirection direction;
/// Returns a rect of the same size as this box.
Rect toRect() => new Rect.fromLTRB(left, top, right, bottom);
Rect toRect() => Rect.fromLTRB(left, top, right, bottom);
/// The [left] edge of the box for left-to-right text; the [right] edge of the box for right-to-left text.
///
......@@ -1139,7 +1139,7 @@ class TextPosition {
/// The arguments must not be null (so the [offset] argument is required).
const TextPosition({
this.offset,
this.affinity: TextAffinity.downstream,
this.affinity = TextAffinity.downstream,
}) : assert(offset != null),
assert(affinity != null);
......@@ -1377,7 +1377,7 @@ class Paragraph extends NativeFieldWrapperClass2 {
/// Returns the text position closest to the given offset.
TextPosition getPositionForOffset(Offset offset) {
final List<int> encoded = _getPositionForOffset(offset.dx, offset.dy);
return new TextPosition(offset: encoded[0], affinity: TextAffinity.values[encoded[1]]);
return TextPosition(offset: encoded[0], affinity: TextAffinity.values[encoded[1]]);
}
List<int> _getPositionForOffset(double dx, double dy) native 'Paragraph_getPositionForOffset';
......@@ -1410,7 +1410,7 @@ class Paragraph extends NativeFieldWrapperClass2 {
/// paint it with [Canvas.drawParagraph].
class ParagraphBuilder extends NativeFieldWrapperClass2 {
/// Creates a [ParagraphBuilder] object, which is used to create a
/// Creates a new [ParagraphBuilder] object, which is used to create a
/// [Paragraph].
@pragma('vm:entry-point')
ParagraphBuilder(ParagraphStyle style) {
......@@ -1503,7 +1503,7 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 {
void addText(String text) {
final String error = _addText(text);
if (error != null)
throw new ArgumentError(error);
throw ArgumentError(error);
}
String _addText(String text) native 'ParagraphBuilder_addText';
......
......@@ -108,7 +108,7 @@ class WindowPadding {
final double bottom;
/// A window padding that has zeros for each edge.
static const WindowPadding zero = const WindowPadding._(left: 0.0, top: 0.0, right: 0.0, bottom: 0.0);
static const WindowPadding zero = WindowPadding._(left: 0.0, top: 0.0, right: 0.0, bottom: 0.0);
@override
String toString() {
......@@ -141,8 +141,8 @@ class Locale {
/// For example:
///
/// ```dart
/// const Locale swissFrench = const Locale('fr', 'CH');
/// const Locale canadianFrench = const Locale('fr', 'CA');
/// const Locale swissFrench = Locale('fr', 'CH');
/// const Locale canadianFrench = Locale('fr', 'CA');
/// ```
///
/// The primary language subtag must not be null. The region subtag is
......@@ -228,7 +228,7 @@ class Locale {
// This map is generated by //flutter/tools/gen_locale.dart
// Mappings generated for language subtag registry as of 2019-02-27.
static const Map<String, String> _deprecatedLanguageSubtagMap = const <String, String>{
static const Map<String, String> _deprecatedLanguageSubtagMap = <String, String>{
'in': 'id', // Indonesian; deprecated 1989-01-01
'iw': 'he', // Hebrew; deprecated 1989-01-01
'ji': 'yi', // Yiddish; deprecated 1989-01-01
......@@ -347,7 +347,7 @@ class Locale {
// This map is generated by //flutter/tools/gen_locale.dart
// Mappings generated for language subtag registry as of 2019-02-27.
static const Map<String, String> _deprecatedRegionSubtagMap = const <String, String>{
static const Map<String, String> _deprecatedRegionSubtagMap = <String, String>{
'BU': 'MM', // Burma; deprecated 1989-12-05
'DD': 'DE', // German Democratic Republic; deprecated 1990-10-30
'FX': 'FR', // Metropolitan France; deprecated 1997-07-14
......@@ -867,7 +867,7 @@ class Window {
final String error =
_sendPlatformMessage(name, _zonedPlatformMessageResponseCallback(callback), data);
if (error != null)
throw new Exception(error);
throw Exception(error);
}
String _sendPlatformMessage(String name,
PlatformMessageResponseCallback callback,
......@@ -1002,4 +1002,4 @@ enum Brightness {
/// The [Window] singleton. This object exposes the size of the display, the
/// core scheduler API, the input event callback, the graphics drawing API, and
/// other such core services.
final Window window = new Window._();
final Window window = Window._();
......@@ -10,53 +10,53 @@ void main() {
@pragma('vm:entry-point')
void sayHi() {
print("Hi");
print('Hi');
}
@pragma('vm:entry-point')
void throwExceptionNow() {
throw("Hello");
throw 'Hello';
}
@pragma('vm:entry-point')
void canRegisterNativeCallback() async {
print("In function canRegisterNativeCallback");
NotifyNative();
print("Called native method from canRegisterNativeCallback");
print('In function canRegisterNativeCallback');
notifyNative();
print('Called native method from canRegisterNativeCallback');
}
void NotifyNative() native "NotifyNative";
void notifyNative() native 'NotifyNative';
@pragma('vm:entry-point')
void testIsolateShutdown() { }
@pragma('vm:entry-point')
void testCanSaveCompilationTrace() {
List<int> trace = null;
List<int> trace;
try {
trace = saveCompilationTrace();
} catch (exception) {
print("Could not save compilation trace: " + exception);
print('Could not save compilation trace: ' + exception);
}
NotifyResult(trace != null && trace.length > 0);
notifyResult(trace != null && trace.isNotEmpty);
}
void NotifyResult(bool success) native "NotifyNative";
void PassMessage(String message) native "PassMessage";
void notifyResult(bool success) native 'NotifyNative';
void passMessage(String message) native 'PassMessage';
void secondaryIsolateMain(String message) {
print("Secondary isolate got message: " + message);
PassMessage("Hello from code is secondary isolate.");
NotifyNative();
print('Secondary isolate got message: ' + message);
passMessage('Hello from code is secondary isolate.');
notifyNative();
}
@pragma('vm:entry-point')
void testCanLaunchSecondaryIsolate() {
Isolate.spawn(secondaryIsolateMain, "Hello from root isolate.");
NotifyNative();
Isolate.spawn(secondaryIsolateMain, 'Hello from root isolate.');
notifyNative();
}
@pragma('vm:entry-point')
void testCanRecieveArguments(List<String> args) {
NotifyResult(args != null && args.length == 1 && args[0] == "arg1");
notifyResult(args != null && args.length == 1 && args[0] == 'arg1');
}
......@@ -4,24 +4,24 @@
import 'dart:isolate';
main() {}
void main() {}
@pragma('vm:entry-point')
fixturesAreFunctionalMain() {
SayHiFromFixturesAreFunctionalMain();
void fixturesAreFunctionalMain() {
sayHiFromFixturesAreFunctionalMain();
}
void SayHiFromFixturesAreFunctionalMain() native "SayHiFromFixturesAreFunctionalMain";
void sayHiFromFixturesAreFunctionalMain() native 'SayHiFromFixturesAreFunctionalMain';
void NotifyNative() native "NotifyNative";
void notifyNative() native 'NotifyNative';
void secondaryIsolateMain(String message) {
print("Secondary isolate got message: " + message);
NotifyNative();
print('Secondary isolate got message: ' + message);
notifyNative();
}
@pragma('vm:entry-point')
void testCanLaunchSecondaryIsolate() {
Isolate.spawn(secondaryIsolateMain, "Hello from root isolate.");
NotifyNative();
Isolate.spawn(secondaryIsolateMain, 'Hello from root isolate.');
notifyNative();
}
......@@ -9,7 +9,7 @@ void customEntrypoint() {
sayHiFromCustomEntrypoint();
}
void sayHiFromCustomEntrypoint() native "SayHiFromCustomEntrypoint";
void sayHiFromCustomEntrypoint() native 'SayHiFromCustomEntrypoint';
@pragma('vm:entry-point')
......@@ -19,9 +19,9 @@ void customEntrypoint1() {
sayHiFromCustomEntrypoint3();
}
void sayHiFromCustomEntrypoint1() native "SayHiFromCustomEntrypoint1";
void sayHiFromCustomEntrypoint2() native "SayHiFromCustomEntrypoint2";
void sayHiFromCustomEntrypoint3() native "SayHiFromCustomEntrypoint3";
void sayHiFromCustomEntrypoint1() native 'SayHiFromCustomEntrypoint1';
void sayHiFromCustomEntrypoint2() native 'SayHiFromCustomEntrypoint2';
void sayHiFromCustomEntrypoint3() native 'SayHiFromCustomEntrypoint3';
@pragma('vm:entry-point')
......@@ -51,16 +51,16 @@ void notifySemanticsAction(int nodeId, int action, List<int> data) native 'Notif
/// Returns a future that completes when `window.onSemanticsEnabledChanged`
/// fires.
Future get semanticsChanged {
final Completer semanticsChanged = Completer();
Future<void> get semanticsChanged {
final Completer<void> semanticsChanged = Completer<void>();
window.onSemanticsEnabledChanged = semanticsChanged.complete;
return semanticsChanged.future;
}
/// Returns a future that completes when `window.onAccessibilityFeaturesChanged`
/// fires.
Future get accessibilityFeaturesChanged {
final Completer featuresChanged = Completer();
Future<void> get accessibilityFeaturesChanged {
final Completer<void> featuresChanged = Completer<void>();
window.onAccessibilityFeaturesChanged = featuresChanged.complete;
return featuresChanged.future;
}
......@@ -73,7 +73,7 @@ class SemanticsActionData {
}
Future<SemanticsActionData> get semanticsAction {
final Completer actionReceived = Completer<SemanticsActionData>();
final Completer<SemanticsActionData> actionReceived = Completer<SemanticsActionData>();
window.onSemanticsAction = (int id, SemanticsAction action, ByteData args) {
actionReceived.complete(SemanticsActionData(id, action, args));
};
......@@ -81,7 +81,7 @@ Future<SemanticsActionData> get semanticsAction {
}
@pragma('vm:entry-point')
void a11y_main() async {
void a11y_main() async { // ignore: non_constant_identifier_names
// Return initial state (semantics disabled).
notifySemanticsEnabled(window.semanticsEnabled);
......
......@@ -9,7 +9,7 @@ import 'dart:convert';
import 'dart:io';
class ShellProcess {
final Completer<Uri> _observatoryUriCompleter = new Completer<Uri>();
final Completer<Uri> _observatoryUriCompleter = Completer<Uri>();
final Process _process;
ShellProcess(this._process) : assert(_process != null) {
......@@ -67,7 +67,7 @@ class ShellLauncher {
shellArguments.addAll(args);
print('Launching $shellExecutablePath $shellArguments');
final Process process = await Process.start(shellExecutablePath, shellArguments);
return new ShellProcess(process);
return ShellProcess(process);
} catch (e) {
print('Error launching shell: $e');
}
......
......@@ -30,7 +30,7 @@ class ServiceClient {
'id': key,
});
client.add(request);
final Completer<Map<String, dynamic>> completer = new Completer<Map<String, dynamic>>();
final Completer<Map<String, dynamic>> completer = Completer<Map<String, dynamic>>();
_outstandingRequests[key] = completer;
print('-> $key ($method)');
return completer.future;
......
......@@ -48,8 +48,8 @@ class Expect {
}
Future<String> readResponse(HttpClientResponse response) {
final Completer<String> completer = new Completer<String>();
final StringBuffer contents = new StringBuffer();
final Completer<String> completer = Completer<String>();
final StringBuffer contents = StringBuffer();
response.transform(utf8.decoder).listen((String data) {
contents.write(data);
}, onDone: () => completer.complete(contents.toString()));
......@@ -59,7 +59,7 @@ Future<String> readResponse(HttpClientResponse response) {
// Test accessing the service protocol over http.
Future<Null> testHttpProtocolRequest(Uri uri) async {
uri = uri.replace(path: 'getVM');
final HttpClient client = new HttpClient();
final HttpClient client = HttpClient();
final HttpClientRequest request = await client.getUrl(uri);
final HttpClientResponse response = await request.close();
Expect.equals(response.statusCode, 200);
......@@ -72,7 +72,7 @@ Future<Null> testHttpProtocolRequest(Uri uri) async {
Future<Null> testWebSocketProtocolRequest(Uri uri) async {
uri = uri.replace(scheme: 'ws', path: 'ws');
final WebSocket webSocketClient = await WebSocket.connect(uri.toString());
final ServiceClient serviceClient = new ServiceClient(webSocketClient);
final ServiceClient serviceClient = ServiceClient(webSocketClient);
final Map<String, dynamic> response = await serviceClient.invokeRPC('getVM');
Expect.equals(response['type'], 'VM');
try {
......@@ -87,7 +87,7 @@ Future<Null> testWebSocketProtocolRequest(Uri uri) async {
// Test accessing an Observatory UI asset.
Future<Null> testHttpAssetRequest(Uri uri) async {
uri = uri.replace(path: 'third_party/trace_viewer_full.html');
final HttpClient client = new HttpClient();
final HttpClient client = HttpClient();
final HttpClientRequest request = await client.getUrl(uri);
final HttpClientResponse response = await request.close();
Expect.equals(response.statusCode, 200);
......@@ -98,10 +98,10 @@ Future<Null> testHttpAssetRequest(Uri uri) async {
Future<Null> testStartPaused(Uri uri) async {
uri = uri.replace(scheme: 'ws', path: 'ws');
final WebSocket webSocketClient = await WebSocket.connect(uri.toString());
final Completer<dynamic> isolateStartedId = new Completer<dynamic>();
final Completer<dynamic> isolatePausedId = new Completer<dynamic>();
final Completer<dynamic> isolateResumeId = new Completer<dynamic>();
final ServiceClient serviceClient = new ServiceClient(webSocketClient,
final Completer<dynamic> isolateStartedId = Completer<dynamic>();
final Completer<dynamic> isolatePausedId = Completer<dynamic>();
final Completer<dynamic> isolateResumeId = Completer<dynamic>();
final ServiceClient serviceClient = ServiceClient(webSocketClient,
isolateStartedId: isolateStartedId,
isolatePausedId: isolatePausedId,
isolateResumeId: isolateResumeId);
......@@ -187,13 +187,13 @@ Future<Null> main(List<String> args) async {
final List<String> extraArgs = args.length <= 2 ? <String>[] : args.sublist(2);
final ShellLauncher launcher =
new ShellLauncher(shellExecutablePath,
ShellLauncher(shellExecutablePath,
mainDartPath,
false,
extraArgs);
final ShellLauncher startPausedlauncher =
new ShellLauncher(shellExecutablePath,
ShellLauncher(shellExecutablePath,
mainDartPath,
true,
extraArgs);
......
......@@ -11,14 +11,14 @@ typedef CanvasCallback = void Function(Canvas canvas);
void testCanvas(CanvasCallback callback) {
try {
callback(Canvas(PictureRecorder(), Rect.fromLTRB(0.0, 0.0, 0.0, 0.0)));
callback(Canvas(PictureRecorder(), const Rect.fromLTRB(0.0, 0.0, 0.0, 0.0)));
} catch (error) { } // ignore: empty_catches
}
void main() {
test('canvas APIs should not crash', () async {
final Paint paint = Paint();
final Rect rect = Rect.fromLTRB(double.nan, double.nan, double.nan, double.nan);
const Rect rect = Rect.fromLTRB(double.nan, double.nan, double.nan, double.nan);
final RRect rrect = RRect.fromRectAndCorners(rect);
const Offset offset = Offset(double.nan, double.nan);
final Path path = Path();
......
......@@ -21,7 +21,7 @@ void main() {
test('paint set to black', () {
const Color c = Color(0x00000000);
final Paint p = new Paint();
final Paint p = Paint();
p.color = c;
expect(c.toString(), equals('Color(0x00000000)'));
});
......@@ -29,7 +29,7 @@ void main() {
test('color created with out of bounds value', () {
try {
const Color c = Color(0x100 << 24);
final Paint p = new Paint();
final Paint p = Paint();
p.color = c;
} catch (e) {
expect(e != null, equals(true));
......@@ -39,7 +39,7 @@ void main() {
test('color created with wildly out of bounds value', () {
try {
const Color c = Color(1 << 1000000);
final Paint p = new Paint();
final Paint p = Paint();
p.color = c;
} catch (e) {
expect(e != null, equals(true));
......
......@@ -47,7 +47,7 @@ void main() {
0, 0, 0, double.infinity,
]);
expect(
() => builder.pushTransform(matrix4NaN),
() => builder.pushTransform(matrix4Infinity),
throwsA(const TypeMatcher<AssertionError>()),
);
});
......
......@@ -9,7 +9,7 @@ import 'package:test/test.dart';
void main() {
test('Gradient.radial with no focal point', () {
expect(
new Gradient.radial(
Gradient.radial(
Offset.zero,
null,
<Color>[const Color(0xFFFFFFFF), const Color(0xFFFFFFFF)],
......@@ -23,7 +23,7 @@ void main() {
test('radial center and focal == Offset.zero and focalRadius == 0.0 is ok',
() {
expect(
() => new Gradient.radial(
() => Gradient.radial(
Offset.zero,
0.0,
<Color>[const Color(0xFFFFFFFF), const Color(0xFFFFFFFF)],
......@@ -38,7 +38,7 @@ void main() {
test('radial center != focal and focalRadius == 0.0 is ok', () {
expect(
() => new Gradient.radial(
() => Gradient.radial(
Offset.zero,
0.0,
<Color>[const Color(0xFFFFFFFF), const Color(0xFFFFFFFF)],
......@@ -55,7 +55,7 @@ void main() {
test('radial center and focal == Offset.zero and focalRadius != 0.0 assert',
() {
expect(
() => new Gradient.radial(
() => Gradient.radial(
Offset.zero,
0.0,
<Color>[const Color(0xFFFFFFFF), const Color(0xFFFFFFFF)],
......
......@@ -9,37 +9,31 @@ import 'package:test/test.dart';
void main() {
test('path getBounds', () {
final Rect r = new Rect.fromLTRB(1.0, 3.0, 5.0, 7.0);
final Path p = new Path()..addRect(r);
const Rect r = Rect.fromLTRB(1.0, 3.0, 5.0, 7.0);
final Path p = Path()..addRect(r);
expect(p.getBounds(), equals(r));
p.lineTo(20.0, 15.0);
expect(p.getBounds(), equals(new Rect.fromLTRB(1.0, 3.0, 20.0, 15.0)));
expect(p.getBounds(), equals(const Rect.fromLTRB(1.0, 3.0, 20.0, 15.0)));
});
test('path combine rect', () {
final Rect c1 =
new Rect.fromCircle(center: const Offset(10.0, 10.0), radius: 10.0);
final Rect c2 =
new Rect.fromCircle(center: const Offset(5.0, 5.0), radius: 10.0);
final Rect c1 = Rect.fromCircle(center: const Offset(10.0, 10.0), radius: 10.0);
final Rect c2 = Rect.fromCircle(center: const Offset(5.0, 5.0), radius: 10.0);
final Rect c1UnionC2 = c1.expandToInclude(c2);
final Rect c1IntersectC2 = c1.intersect(c2);
final Path pathCircle1 = new Path()..addRect(c1);
final Path pathCircle2 = new Path()..addRect(c2);
final Path pathCircle1 = Path()..addRect(c1);
final Path pathCircle2 = Path()..addRect(c2);
final Path difference =
Path.combine(PathOperation.difference, pathCircle1, pathCircle2);
final Path difference = Path.combine(PathOperation.difference, pathCircle1, pathCircle2);
expect(difference.getBounds(), equals(c1));
final Path reverseDifference =
Path.combine(PathOperation.reverseDifference, pathCircle1, pathCircle2);
final Path reverseDifference = Path.combine(PathOperation.reverseDifference, pathCircle1, pathCircle2);
expect(reverseDifference.getBounds(), equals(c2));
final Path union =
Path.combine(PathOperation.union, pathCircle1, pathCircle2);
final Path union = Path.combine(PathOperation.union, pathCircle1, pathCircle2);
expect(union.getBounds(), equals(c1UnionC2));
final Path intersect =
Path.combine(PathOperation.intersect, pathCircle1, pathCircle2);
final Path intersect = Path.combine(PathOperation.intersect, pathCircle1, pathCircle2);
expect(intersect.getBounds(), equals(c1IntersectC2));
// the bounds on this will be the same as union - but would draw a missing inside piece.
......@@ -48,31 +42,24 @@ void main() {
});
test('path combine oval', () {
final Rect c1 =
new Rect.fromCircle(center: const Offset(10.0, 10.0), radius: 10.0);
final Rect c2 =
new Rect.fromCircle(center: const Offset(5.0, 5.0), radius: 10.0);
final Rect c1 = Rect.fromCircle(center: const Offset(10.0, 10.0), radius: 10.0);
final Rect c2 = Rect.fromCircle(center: const Offset(5.0, 5.0), radius: 10.0);
final Rect c1UnionC2 = c1.expandToInclude(c2);
final Rect c1IntersectC2 = c1.intersect(c2);
final Path pathCircle1 = new Path()..addOval(c1);
final Path pathCircle2 = new Path()..addOval(c2);
final Path pathCircle1 = Path()..addOval(c1);
final Path pathCircle2 = Path()..addOval(c2);
final Path difference =
Path.combine(PathOperation.difference, pathCircle1, pathCircle2);
final Path difference = Path.combine(PathOperation.difference, pathCircle1, pathCircle2);
expect(difference.getBounds().top, closeTo(0.88, 0.01));
final Path reverseDifference =
Path.combine(PathOperation.reverseDifference, pathCircle1, pathCircle2);
expect(reverseDifference.getBounds().right,
closeTo(14.11, 0.01));
final Path reverseDifference = Path.combine(PathOperation.reverseDifference, pathCircle1, pathCircle2);
expect(reverseDifference.getBounds().right, closeTo(14.11, 0.01));
final Path union =
Path.combine(PathOperation.union, pathCircle1, pathCircle2);
final Path union = Path.combine(PathOperation.union, pathCircle1, pathCircle2);
expect(union.getBounds(), equals(c1UnionC2));
final Path intersect =
Path.combine(PathOperation.intersect, pathCircle1, pathCircle2);
final Path intersect = Path.combine(PathOperation.intersect, pathCircle1, pathCircle2);
expect(intersect.getBounds(), equals(c1IntersectC2));
// the bounds on this will be the same as union - but would draw a missing inside piece.
......@@ -81,8 +68,8 @@ void main() {
});
test('path clone', () {
final Path p1 = new Path()..lineTo(20.0, 20.0);
final Path p2 = new Path.from(p1);
final Path p1 = Path()..lineTo(20.0, 20.0);
final Path p2 = Path.from(p1);
expect(p1.getBounds(), equals(p2.getBounds()));
......@@ -91,8 +78,8 @@ void main() {
});
test('transformation tests', () {
final Rect bounds = new Rect.fromLTRB(0.0, 0.0, 10.0, 10.0);
final Path p = new Path()..addRect(bounds);
const Rect bounds = Rect.fromLTRB(0.0, 0.0, 10.0, 10.0);
final Path p = Path()..addRect(bounds);
final Float64List scaleMatrix = Float64List.fromList(<double>[
2.5, 0.0, 0.0, 0.0, // first col
0.0, 0.5, 0.0, 0.0, // second col
......@@ -104,41 +91,37 @@ void main() {
final Path pTransformed = p.transform(scaleMatrix);
expect(pTransformed.getBounds(),
equals(new Rect.fromLTRB(0.0, 0.0, 10 * 2.5, 10 * 0.5)));
equals(const Rect.fromLTRB(0.0, 0.0, 10 * 2.5, 10 * 0.5)));
final Path p2 = new Path()..lineTo(10.0, 10.0);
final Path p2 = Path()..lineTo(10.0, 10.0);
p.addPath(p2, const Offset(10.0, 10.0));
expect(p.getBounds(), equals(new Rect.fromLTRB(0.0, 0.0, 20.0, 20.0)));
expect(p.getBounds(), equals(const Rect.fromLTRB(0.0, 0.0, 20.0, 20.0)));
p.addPath(p2, const Offset(20.0, 20.0), matrix4: scaleMatrix);
expect(p.getBounds(),
equals(new Rect.fromLTRB(0.0, 0.0, 20 + (10 * 2.5), 20 + (10 * .5))));
equals(const Rect.fromLTRB(0.0, 0.0, 20 + (10 * 2.5), 20 + (10 * .5))));
p.extendWithPath(p2, const Offset(0.0, 0.0));
expect(p.getBounds(), equals(new Rect.fromLTRB(0.0, 0.0, 45.0, 25.0)));
expect(p.getBounds(), equals(const Rect.fromLTRB(0.0, 0.0, 45.0, 25.0)));
p.extendWithPath(p2, const Offset(45.0, 25.0), matrix4: scaleMatrix);
expect(p.getBounds(), equals(new Rect.fromLTRB(0.0, 0.0, 70.0, 30.0)));
expect(p.getBounds(), equals(const Rect.fromLTRB(0.0, 0.0, 70.0, 30.0)));
});
test('path metrics tests', () {
final Path simpleHorizontalLine = new Path()..lineTo(10.0, 0.0);
final Path simpleHorizontalLine = Path()..lineTo(10.0, 0.0);
// basic tests on horizontal line
final PathMetrics simpleHorizontalMetrics =
simpleHorizontalLine.computeMetrics();
final PathMetrics simpleHorizontalMetrics = simpleHorizontalLine.computeMetrics();
expect(simpleHorizontalMetrics.iterator.current, isNull);
expect(simpleHorizontalMetrics.iterator.moveNext(), isTrue);
expect(simpleHorizontalMetrics.iterator.current, isNotNull);
expect(simpleHorizontalMetrics.iterator.current.length, equals(10.0));
expect(simpleHorizontalMetrics.iterator.current.isClosed, isFalse);
final Path simpleExtract =
simpleHorizontalMetrics.iterator.current.extractPath(1.0, 9.0);
expect(simpleExtract.getBounds(),
equals(new Rect.fromLTRB(1.0, 0.0, 9.0, 0.0)));
final Tangent posTan =
simpleHorizontalMetrics.iterator.current.getTangentForOffset(1.0);
final Path simpleExtract = simpleHorizontalMetrics.iterator.current.extractPath(1.0, 9.0);
expect(simpleExtract.getBounds(), equals(const Rect.fromLTRB(1.0, 0.0, 9.0, 0.0)));
final Tangent posTan = simpleHorizontalMetrics.iterator.current.getTangentForOffset(1.0);
expect(posTan, isNotNull);
expect(posTan.position, equals(const Offset(1.0, 0.0)));
expect(posTan.angle, equals(0.0));
......@@ -147,43 +130,33 @@ void main() {
expect(simpleHorizontalMetrics.iterator.current, isNull);
// test with forceClosed
final PathMetrics simpleMetricsClosed =
simpleHorizontalLine.computeMetrics(forceClosed: true);
final PathMetrics simpleMetricsClosed = simpleHorizontalLine.computeMetrics(forceClosed: true);
expect(simpleMetricsClosed.iterator.current, isNull);
expect(simpleMetricsClosed.iterator.moveNext(), isTrue);
expect(simpleMetricsClosed.iterator.current, isNotNull);
expect(simpleMetricsClosed.iterator.current.length,
equals(20.0)); // because we forced close
expect(simpleMetricsClosed.iterator.current.length, equals(20.0)); // because we forced close
expect(simpleMetricsClosed.iterator.current.isClosed, isTrue);
final Path simpleExtract2 =
simpleMetricsClosed.iterator.current.extractPath(1.0, 9.0);
expect(simpleExtract2.getBounds(),
equals(new Rect.fromLTRB(1.0, 0.0, 9.0, 0.0)));
final Path simpleExtract2 = simpleMetricsClosed.iterator.current.extractPath(1.0, 9.0);
expect(simpleExtract2.getBounds(), equals(const Rect.fromLTRB(1.0, 0.0, 9.0, 0.0)));
expect(simpleMetricsClosed.iterator.moveNext(), isFalse);
// test getTangentForOffset with vertical line
final Path simpleVerticalLine = new Path()..lineTo(0.0, 10.0);
final PathMetrics simpleMetricsVertical =
simpleVerticalLine.computeMetrics()..iterator.moveNext();
final Tangent posTanVertical =
simpleMetricsVertical.iterator.current.getTangentForOffset(5.0);
final Path simpleVerticalLine = Path()..lineTo(0.0, 10.0);
final PathMetrics simpleMetricsVertical = simpleVerticalLine.computeMetrics()..iterator.moveNext();
final Tangent posTanVertical = simpleMetricsVertical.iterator.current.getTangentForOffset(5.0);
expect(posTanVertical.position, equals(const Offset(0.0, 5.0)));
expect(posTanVertical.angle,
closeTo(-1.5708, .0001)); // 90 degrees
expect(posTanVertical.angle, closeTo(-1.5708, .0001)); // 90 degrees
// test getTangentForOffset with diagonal line
final Path simpleDiagonalLine = new Path()..lineTo(10.0, 10.0);
final PathMetrics simpleMetricsDiagonal =
simpleDiagonalLine.computeMetrics()..iterator.moveNext();
final Path simpleDiagonalLine = Path()..lineTo(10.0, 10.0);
final PathMetrics simpleMetricsDiagonal = simpleDiagonalLine.computeMetrics()..iterator.moveNext();
final double midPoint = simpleMetricsDiagonal.iterator.current.length / 2;
final Tangent posTanDiagonal =
simpleMetricsDiagonal.iterator.current.getTangentForOffset(midPoint);
final Tangent posTanDiagonal = simpleMetricsDiagonal.iterator.current.getTangentForOffset(midPoint);
expect(posTanDiagonal.position, equals(const Offset(5.0, 5.0)));
expect(posTanDiagonal.angle,
closeTo(-0.7853981633974483, .00001)); // ~45 degrees
expect(posTanDiagonal.angle, closeTo(-0.7853981633974483, .00001)); // ~45 degrees
// test a multi-contour path
final Path multiContour = new Path()
final Path multiContour = Path()
..lineTo(0.0, 10.0)
..moveTo(10.0, 10.0)
..lineTo(10.0, 15.0);
......
......@@ -159,7 +159,7 @@ void main() {
};
});
final ByteData testData = new ByteData.view(new Uint8List(0).buffer);
final ByteData testData = ByteData.view(Uint8List(0).buffer);
_dispatchPointerDataPacket(testData);
expect(runZone, isNotNull);
expect(runZone, same(innerZone));
......
......@@ -12,7 +12,7 @@ void main() {
test('window.sendPlatformMessage preserves callback zone', () {
runZoned(() {
final Zone innerZone = Zone.current;
window.sendPlatformMessage('test', new ByteData.view(new Uint8List(0).buffer), expectAsync1((ByteData data) {
window.sendPlatformMessage('test', ByteData.view(Uint8List(0).buffer), expectAsync1((ByteData data) {
final Zone runZone = Zone.current;
expect(runZone, isNotNull);
expect(runZone, same(innerZone));
......
......@@ -59,6 +59,8 @@ pushd "$BUILDROOT_DIR/flutter/testing/dart"
"$HOST_DIR/dart-sdk/bin/pub" get
popd
"$HOST_DIR/dart" --version
run_test () {
"$HOST_DIR/dart" $HOST_DIR/gen/frontend_server.dart.snapshot \
--sdk-root $HOST_DIR/flutter_patched_sdk \
......
......@@ -32,12 +32,12 @@ void main(List<String> arguments) {
} else if (Platform.isMacOS) {
platform = 'mac-x64';
} else {
throw new UnimplementedError('Script only support running on Linux or MacOS.');
throw UnimplementedError('Script only support running on Linux or MacOS.');
}
final String nmPath = p.join(buildToolsPath, platform, 'clang', 'bin', 'llvm-nm');
assert(new Directory(outPath).existsSync());
final Iterable<String> releaseBuilds = new Directory(outPath).listSync()
final Iterable<String> releaseBuilds = Directory(outPath).listSync()
.where((FileSystemEntity entity) => entity is Directory)
.map<String>((FileSystemEntity dir) => p.basename(dir.path))
.where((String s) => s.contains('_release'));
......@@ -101,16 +101,16 @@ int _checkAndroid(String outPath, String nmPath, Iterable<String> builds) {
continue;
}
final Iterable<NmEntry> entries = NmEntry.parse(nmResult.stdout);
final Map<String, String> entryMap = Map.fromIterable(
final Map<String, String> entryMap = Map<String, String>.fromIterable(
entries,
key: (entry) => entry.name,
value: (entry) => entry.type);
final Map<String, String> expectedSymbols = {
key: (dynamic entry) => entry.name,
value: (dynamic entry) => entry.type);
final Map<String, String> expectedSymbols = <String, String>{
'JNI_OnLoad': 'T',
'_binary_icudtl_dat_size': 'A',
'_binary_icudtl_dat_start': 'D',
};
if (!MapEquality<String, String>().equals(entryMap, expectedSymbols)) {
if (!const MapEquality<String, String>().equals(entryMap, expectedSymbols)) {
print('ERROR: $libFlutter exports the wrong symbols');
print(' Expected $expectedSymbols');
print(' Library has $entryMap.');
......@@ -132,7 +132,7 @@ class NmEntry {
static Iterable<NmEntry> parse(String stdout) {
return LineSplitter.split(stdout).map((String line) {
final List<String> parts = line.split(' ');
return new NmEntry._(parts[0], parts[1], parts.last);
return NmEntry._(parts[0], parts[1], parts.last);
});
}
}
......@@ -39,7 +39,7 @@ Map<String, List<String>> parseSection(String section) {
}
Future<Null> main() async {
final HttpClient client = new HttpClient();
final HttpClient client = HttpClient();
final String body = (await (await (await client.getUrl(Uri.parse(registry))).close()).transform(utf8.decoder).toList()).join('');
final List<Map<String, List<String>>> sections = body.split('%%').map<Map<String, List<String>>>(parseSection).toList();
final Map<String, List<String>> outputs = <String, List<String>>{'language': <String>[], 'region': <String>[]};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册