From 4806a4cc047d474d0ffbf0a24c222d32eaaabc51 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Wed, 10 Jun 2015 12:42:41 -0700 Subject: [PATCH] Remove _emptyList from fn2.dart We can use const [] instead and we'll be sure we don't mutate this constant. R=ianh@google.com Review URL: https://codereview.chromium.org/1178623002. --- sdk/lib/framework/fn2.dart | 8 ++------ specs/style-guide.md | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sdk/lib/framework/fn2.dart b/sdk/lib/framework/fn2.dart index 60acbf0a7c8..bb20e34269e 100644 --- a/sdk/lib/framework/fn2.dart +++ b/sdk/lib/framework/fn2.dart @@ -530,8 +530,6 @@ class CustomPaint extends OneChildRenderObjectWrapper { } -final List _emptyList = new List(); - abstract class MultiChildRenderObjectWrapper extends RenderObjectWrapper { // In MultiChildRenderObjectWrapper subclasses, slots are RenderObject nodes @@ -540,10 +538,8 @@ abstract class MultiChildRenderObjectWrapper extends RenderObjectWrapper { MultiChildRenderObjectWrapper({ Object key, List children - }) : this.children = children == null ? _emptyList : children, - super( - key: key - ) { + }) : this.children = children == null ? const [] : children, + super(key: key) { assert(!_debugHasDuplicateIds()); } diff --git a/specs/style-guide.md b/specs/style-guide.md index 137937a96fb..b1f65d64e81 100644 --- a/specs/style-guide.md +++ b/specs/style-guide.md @@ -51,8 +51,7 @@ same order (unless the order matters). All variables and arguments are typed; don't use "var", "dynamic", or "Object" in any case where you could figure out the actual type. -Always specialise generic types where possible. Even for ```[]``` and -```{}``` literals, include the types. +Always specialise generic types where possible. Aim for a line length of 80 characters, but go over if breaking the line would make it less readable.