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
f540c978
Commit
f540c978
authored
Apr 14, 2016
by
Phil Quitslund
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3333 from pq/optional_type_args
Adding `@optionalTypeArgs`.
parents
a2b704b8
de25ea22
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+4
-0
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+2
-0
pubspec.yaml
packages/flutter/pubspec.yaml
+2
-0
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+0
-6
No files found.
packages/flutter/lib/src/widgets/framework.dart
View file @
f540c978
...
@@ -10,6 +10,7 @@ import 'debug.dart';
...
@@ -10,6 +10,7 @@ import 'debug.dart';
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
import
'package:meta/meta.dart'
;
export
'dart:ui'
show
hashValues
,
hashList
;
export
'dart:ui'
show
hashValues
,
hashList
;
export
'package:flutter/rendering.dart'
show
RenderObject
,
RenderBox
,
debugPrint
;
export
'package:flutter/rendering.dart'
show
RenderObject
,
RenderBox
,
debugPrint
;
...
@@ -112,6 +113,7 @@ typedef void GlobalKeyRemoveListener(GlobalKey key);
...
@@ -112,6 +113,7 @@ typedef void GlobalKeyRemoveListener(GlobalKey key);
/// GlobalKeys are relatively expensive. If you don't need any of the features
/// GlobalKeys are relatively expensive. If you don't need any of the features
/// listed above, consider using a [Key], [ValueKey], [ObjectKey], or
/// listed above, consider using a [Key], [ValueKey], [ObjectKey], or
/// [UniqueKey] instead.
/// [UniqueKey] instead.
@optionalTypeArgs
abstract
class
GlobalKey
<
T
extends
State
<
StatefulWidget
>>
extends
Key
{
abstract
class
GlobalKey
<
T
extends
State
<
StatefulWidget
>>
extends
Key
{
/// Constructs a LabeledGlobalKey, which is a GlobalKey with a label used for debugging.
/// Constructs a LabeledGlobalKey, which is a GlobalKey with a label used for debugging.
/// The label is not used for comparing the identity of the key.
/// The label is not used for comparing the identity of the key.
...
@@ -253,6 +255,7 @@ class GlobalObjectKey extends GlobalKey {
...
@@ -253,6 +255,7 @@ class GlobalObjectKey extends GlobalKey {
}
}
/// This class is a work-around for the "is" operator not accepting a variable value as its right operand
/// This class is a work-around for the "is" operator not accepting a variable value as its right operand
@optionalTypeArgs
class
TypeMatcher
<
T
>
{
class
TypeMatcher
<
T
>
{
const
TypeMatcher
();
const
TypeMatcher
();
bool
check
(
dynamic
object
)
=>
object
is
T
;
bool
check
(
dynamic
object
)
=>
object
is
T
;
...
@@ -346,6 +349,7 @@ enum _StateLifecycle {
...
@@ -346,6 +349,7 @@ enum _StateLifecycle {
typedef
void
StateSetter
(
VoidCallback
fn
);
typedef
void
StateSetter
(
VoidCallback
fn
);
/// The logic and internal state for a [StatefulWidget].
/// The logic and internal state for a [StatefulWidget].
@optionalTypeArgs
abstract
class
State
<
T
extends
StatefulWidget
>
{
abstract
class
State
<
T
extends
StatefulWidget
>
{
/// The current configuration (an instance of the corresponding
/// The current configuration (an instance of the corresponding
/// [StatefulWidget] class).
/// [StatefulWidget] class).
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
f540c978
...
@@ -8,6 +8,7 @@ import 'dart:ui' as ui show window;
...
@@ -8,6 +8,7 @@ import 'dart:ui' as ui show window;
import
'package:newton/newton.dart'
;
import
'package:newton/newton.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:meta/meta.dart'
;
import
'basic.dart'
;
import
'basic.dart'
;
import
'framework.dart'
;
import
'framework.dart'
;
...
@@ -217,6 +218,7 @@ abstract class Scrollable extends StatefulWidget {
...
@@ -217,6 +218,7 @@ abstract class Scrollable extends StatefulWidget {
/// along the [config.scrollDirection] axis and are implemented in
/// along the [config.scrollDirection] axis and are implemented in
/// terms of the [pixelOffsetToScrollOffset] and
/// terms of the [pixelOffsetToScrollOffset] and
/// [scrollOffsetToPixelOffset] methods.
/// [scrollOffsetToPixelOffset] methods.
@optionalTypeArgs
abstract
class
ScrollableState
<
T
extends
Scrollable
>
extends
State
<
T
>
{
abstract
class
ScrollableState
<
T
extends
Scrollable
>
extends
State
<
T
>
{
@override
@override
void
initState
()
{
void
initState
()
{
...
...
packages/flutter/pubspec.yaml
View file @
f540c978
...
@@ -12,6 +12,8 @@ dependencies:
...
@@ -12,6 +12,8 @@ dependencies:
# We need to pin crypto because archive can't handle larger numbers.
# We need to pin crypto because archive can't handle larger numbers.
crypto
:
0.9.2
crypto
:
0.9.2
meta
:
^0.12.0
sky_engine
:
sky_engine
:
path
:
../../bin/cache/pkg/sky_engine
path
:
../../bin/cache/pkg/sky_engine
sky_services
:
sky_services
:
...
...
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
f540c978
...
@@ -357,7 +357,6 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -357,7 +357,6 @@ class AnalyzeCommand extends FlutterCommand {
];
];
RegExp
generalPattern
=
new
RegExp
(
r'^\[(error|warning|hint|lint)\] (.+) \(([^(),]+), line ([0-9]+), col ([0-9]+)\)$'
);
RegExp
generalPattern
=
new
RegExp
(
r'^\[(error|warning|hint|lint)\] (.+) \(([^(),]+), line ([0-9]+), col ([0-9]+)\)$'
);
RegExp
classesWithOptionalTypeArgumentsPattern
=
new
RegExp
(
r'\b(GlobalKey|State|ScrollableState|Element|StatelessElement|TypeMatcher)\b'
);
RegExp
conflictingNamesPattern
=
new
RegExp
(
'^The imported libraries
\'
([^
\'
]+)
\'
and
\'
([^
\'
]+)
\'
cannot have the same name
\'
([^
\'
]+)
\'
\$
'
);
RegExp
conflictingNamesPattern
=
new
RegExp
(
'^The imported libraries
\'
([^
\'
]+)
\'
and
\'
([^
\'
]+)
\'
cannot have the same name
\'
([^
\'
]+)
\'
\$
'
);
RegExp
missingFilePattern
=
new
RegExp
(
'^Target of URI does not exist:
\'
([^
\'
)]+)
\'
\$
'
);
RegExp
missingFilePattern
=
new
RegExp
(
'^Target of URI does not exist:
\'
([^
\'
)]+)
\'
\$
'
);
RegExp
documentAllMembersPattern
=
new
RegExp
(
'^Document all public members
\$
'
);
RegExp
documentAllMembersPattern
=
new
RegExp
(
'^Document all public members
\$
'
);
...
@@ -419,11 +418,6 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -419,11 +418,6 @@ class AnalyzeCommand extends FlutterCommand {
}
else
if
(
sourceLines
.
first
.
startsWith
(
'// DO NOT EDIT. This is code generated'
))
{
}
else
if
(
sourceLines
.
first
.
startsWith
(
'// DO NOT EDIT. This is code generated'
))
{
// autogenerated code - TODO(ianh): Fix the intl package resource generator
// autogenerated code - TODO(ianh): Fix the intl package resource generator
shouldIgnore
=
true
;
shouldIgnore
=
true
;
}
else
if
(
level
==
'lint'
&&
errorMessage
==
'Specify type annotations.'
)
{
// we want the type annotations on certain classes to be optional.
// see https://github.com/dart-lang/linter/issues/196
if
(
classesWithOptionalTypeArgumentsPattern
.
matchAsPrefix
(
sourceLine
,
colNumber
-
1
)
!=
null
)
shouldIgnore
=
true
;
}
}
if
(
shouldIgnore
)
if
(
shouldIgnore
)
continue
;
continue
;
...
...
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