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
1c7a1c38
Unverified
Commit
1c7a1c38
authored
Dec 04, 2019
by
Alexandre Ardhuin
Committed by
GitHub
Dec 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implicit-casts:false in flutter/lib/src/services (#45723)
parent
f908e182
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
82 additions
and
83 deletions
+82
-83
asset_bundle.dart
packages/flutter/lib/src/services/asset_bundle.dart
+1
-1
clipboard.dart
packages/flutter/lib/src/services/clipboard.dart
+1
-1
keyboard_key.dart
packages/flutter/lib/src/services/keyboard_key.dart
+4
-4
message_codecs.dart
packages/flutter/lib/src/services/message_codecs.dart
+4
-4
platform_channel.dart
packages/flutter/lib/src/services/platform_channel.dart
+1
-1
platform_views.dart
packages/flutter/lib/src/services/platform_views.dart
+1
-1
raw_keyboard.dart
packages/flutter/lib/src/services/raw_keyboard.dart
+30
-30
system_chrome.dart
packages/flutter/lib/src/services/system_chrome.dart
+7
-7
text_editing.dart
packages/flutter/lib/src/services/text_editing.dart
+5
-7
text_input.dart
packages/flutter/lib/src/services/text_input.dart
+26
-25
platform_channel_test.dart
packages/flutter/test/services/platform_channel_test.dart
+2
-2
No files found.
packages/flutter/lib/src/services/asset_bundle.dart
View file @
1c7a1c38
...
...
@@ -178,7 +178,7 @@ abstract class CachingAssetBundle extends AssetBundle {
assert
(
key
!=
null
);
assert
(
parser
!=
null
);
if
(
_structuredDataCache
.
containsKey
(
key
))
return
_structuredDataCache
[
key
];
return
_structuredDataCache
[
key
]
as
Future
<
T
>
;
Completer
<
T
>
completer
;
Future
<
T
>
result
;
loadString
(
key
,
cache:
false
).
then
<
T
>(
parser
).
then
<
void
>((
T
value
)
{
...
...
packages/flutter/lib/src/services/clipboard.dart
View file @
1c7a1c38
...
...
@@ -56,6 +56,6 @@ class Clipboard {
);
if
(
result
==
null
)
return
null
;
return
ClipboardData
(
text:
result
[
'text'
]);
return
ClipboardData
(
text:
result
[
'text'
]
as
String
);
}
}
packages/flutter/lib/src/services/keyboard_key.dart
View file @
1c7a1c38
...
...
@@ -171,8 +171,8 @@ class LogicalKeyboardKey extends KeyboardKey {
if
(
other
.
runtimeType
!=
runtimeType
)
{
return
false
;
}
final
LogicalKeyboardKey
typedOther
=
other
;
return
keyId
==
typedOther
.
keyId
;
return
other
is
LogicalKeyboardKey
&&
other
.
keyId
==
keyId
;
}
/// Returns the [LogicalKeyboardKey] constant that matches the given ID, or
...
...
@@ -2073,8 +2073,8 @@ class PhysicalKeyboardKey extends KeyboardKey {
if
(
other
.
runtimeType
!=
runtimeType
)
{
return
false
;
}
final
PhysicalKeyboardKey
typedOther
=
other
;
return
usbHidUsage
==
typedOther
.
usbHidUsage
;
return
other
is
PhysicalKeyboardKey
&&
other
.
usbHidUsage
==
usbHidUsage
;
}
@override
...
...
packages/flutter/lib/src/services/message_codecs.dart
View file @
1c7a1c38
...
...
@@ -147,8 +147,8 @@ class JSONMethodCodec implements MethodCodec {
&&
decoded
[
0
]
is
String
&&
(
decoded
[
1
]
==
null
||
decoded
[
1
]
is
String
))
throw
PlatformException
(
code:
decoded
[
0
],
message:
decoded
[
1
],
code:
decoded
[
0
]
as
String
,
message:
decoded
[
1
]
as
String
,
details:
decoded
[
2
],
);
throw
FormatException
(
'Invalid envelope:
$decoded
'
);
...
...
@@ -356,7 +356,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
}
}
else
if
(
value
is
String
)
{
buffer
.
putUint8
(
_valueString
);
final
List
<
int
>
bytes
=
utf8
.
encoder
.
convert
(
value
);
final
Uint8List
bytes
=
utf8
.
encoder
.
convert
(
value
);
writeSize
(
buffer
,
bytes
.
length
);
buffer
.
putUint8List
(
bytes
);
}
else
if
(
value
is
Uint8List
)
{
...
...
@@ -566,7 +566,7 @@ class StandardMethodCodec implements MethodCodec {
final
dynamic
errorMessage
=
messageCodec
.
readValue
(
buffer
);
final
dynamic
errorDetails
=
messageCodec
.
readValue
(
buffer
);
if
(
errorCode
is
String
&&
(
errorMessage
==
null
||
errorMessage
is
String
)
&&
!
buffer
.
hasRemaining
)
throw
PlatformException
(
code:
errorCode
,
message:
errorMessage
,
details:
errorDetails
);
throw
PlatformException
(
code:
errorCode
,
message:
errorMessage
as
String
,
details:
errorDetails
);
else
throw
const
FormatException
(
'Invalid envelope'
);
}
...
...
packages/flutter/lib/src/services/platform_channel.dart
View file @
1c7a1c38
...
...
@@ -318,7 +318,7 @@ class MethodChannel {
if
(
result
==
null
)
{
throw
MissingPluginException
(
'No implementation found for method
$method
on channel
$name
'
);
}
final
T
typedResult
=
codec
.
decodeEnvelope
(
result
);
final
T
typedResult
=
codec
.
decodeEnvelope
(
result
)
as
T
;
return
typedResult
;
}
...
...
packages/flutter/lib/src/services/platform_views.dart
View file @
1c7a1c38
...
...
@@ -65,7 +65,7 @@ class PlatformViewsService {
Future
<
void
>
_onMethodCall
(
MethodCall
call
)
{
switch
(
call
.
method
)
{
case
'viewFocused'
:
final
int
id
=
call
.
arguments
;
final
int
id
=
call
.
arguments
as
int
;
if
(
_focusCallbacks
.
containsKey
(
id
))
{
_focusCallbacks
[
id
]();
}
...
...
packages/flutter/lib/src/services/raw_keyboard.dart
View file @
1c7a1c38
...
...
@@ -249,51 +249,51 @@ abstract class RawKeyEvent extends Diagnosticable {
factory
RawKeyEvent
.
fromMessage
(
Map
<
String
,
dynamic
>
message
)
{
RawKeyEventData
data
;
final
String
keymap
=
message
[
'keymap'
];
final
String
keymap
=
message
[
'keymap'
]
as
String
;
switch
(
keymap
)
{
case
'android'
:
data
=
RawKeyEventDataAndroid
(
flags:
message
[
'flags'
]
??
0
,
codePoint:
message
[
'codePoint'
]
??
0
,
keyCode:
message
[
'keyCode'
]
??
0
,
plainCodePoint:
message
[
'plainCodePoint'
]
??
0
,
scanCode:
message
[
'scanCode'
]
??
0
,
metaState:
message
[
'metaState'
]
??
0
,
eventSource:
message
[
'source'
]
??
0
,
vendorId:
message
[
'vendorId'
]
??
0
,
productId:
message
[
'productId'
]
??
0
,
deviceId:
message
[
'deviceId'
]
??
0
,
repeatCount:
message
[
'repeatCount'
]
??
0
,
flags:
message
[
'flags'
]
as
int
??
0
,
codePoint:
message
[
'codePoint'
]
as
int
??
0
,
keyCode:
message
[
'keyCode'
]
as
int
??
0
,
plainCodePoint:
message
[
'plainCodePoint'
]
as
int
??
0
,
scanCode:
message
[
'scanCode'
]
as
int
??
0
,
metaState:
message
[
'metaState'
]
as
int
??
0
,
eventSource:
message
[
'source'
]
as
int
??
0
,
vendorId:
message
[
'vendorId'
]
as
int
??
0
,
productId:
message
[
'productId'
]
as
int
??
0
,
deviceId:
message
[
'deviceId'
]
as
int
??
0
,
repeatCount:
message
[
'repeatCount'
]
as
int
??
0
,
);
break
;
case
'fuchsia'
:
data
=
RawKeyEventDataFuchsia
(
hidUsage:
message
[
'hidUsage'
]
??
0
,
codePoint:
message
[
'codePoint'
]
??
0
,
modifiers:
message
[
'modifiers'
]
??
0
,
hidUsage:
message
[
'hidUsage'
]
as
int
??
0
,
codePoint:
message
[
'codePoint'
]
as
int
??
0
,
modifiers:
message
[
'modifiers'
]
as
int
??
0
,
);
break
;
case
'macos'
:
data
=
RawKeyEventDataMacOs
(
characters:
message
[
'characters'
]
??
''
,
charactersIgnoringModifiers:
message
[
'charactersIgnoringModifiers'
]
??
''
,
keyCode:
message
[
'keyCode'
]
??
0
,
modifiers:
message
[
'modifiers'
]
??
0
);
characters:
message
[
'characters'
]
as
String
??
''
,
charactersIgnoringModifiers:
message
[
'charactersIgnoringModifiers'
]
as
String
??
''
,
keyCode:
message
[
'keyCode'
]
as
int
??
0
,
modifiers:
message
[
'modifiers'
]
as
int
??
0
);
break
;
case
'linux'
:
data
=
RawKeyEventDataLinux
(
keyHelper:
KeyHelper
(
message
[
'toolkit'
]
??
''
),
unicodeScalarValues:
message
[
'unicodeScalarValues'
]
??
0
,
keyCode:
message
[
'keyCode'
]
??
0
,
scanCode:
message
[
'scanCode'
]
??
0
,
modifiers:
message
[
'modifiers'
]
??
0
,
keyHelper:
KeyHelper
(
message
[
'toolkit'
]
as
String
??
''
),
unicodeScalarValues:
message
[
'unicodeScalarValues'
]
as
int
??
0
,
keyCode:
message
[
'keyCode'
]
as
int
??
0
,
scanCode:
message
[
'scanCode'
]
as
int
??
0
,
modifiers:
message
[
'modifiers'
]
as
int
??
0
,
isDown:
message
[
'type'
]
==
'keydown'
);
break
;
case
'web'
:
data
=
RawKeyEventDataWeb
(
code:
message
[
'code'
],
key:
message
[
'key'
],
metaState:
message
[
'metaState'
],
code:
message
[
'code'
]
as
String
,
key:
message
[
'key'
]
as
String
,
metaState:
message
[
'metaState'
]
as
int
,
);
break
;
default
:
...
...
@@ -303,10 +303,10 @@ abstract class RawKeyEvent extends Diagnosticable {
throw
FlutterError
(
'Unknown keymap for key events:
$keymap
'
);
}
final
String
type
=
message
[
'type'
];
final
String
type
=
message
[
'type'
]
as
String
;
switch
(
type
)
{
case
'keydown'
:
return
RawKeyDownEvent
(
data:
data
,
character:
message
[
'character'
]);
return
RawKeyDownEvent
(
data:
data
,
character:
message
[
'character'
]
as
String
);
case
'keyup'
:
return
RawKeyUpEvent
(
data:
data
);
default
:
...
...
@@ -498,7 +498,7 @@ class RawKeyboard {
}
Future
<
dynamic
>
_handleKeyEvent
(
dynamic
message
)
async
{
final
RawKeyEvent
event
=
RawKeyEvent
.
fromMessage
(
message
);
final
RawKeyEvent
event
=
RawKeyEvent
.
fromMessage
(
message
as
Map
<
String
,
dynamic
>
);
if
(
event
==
null
)
{
return
;
}
...
...
packages/flutter/lib/src/services/system_chrome.dart
View file @
1c7a1c38
...
...
@@ -196,13 +196,13 @@ class SystemUiOverlayStyle {
bool
operator
==(
dynamic
other
)
{
if
(
other
.
runtimeType
!=
runtimeType
)
return
false
;
final
SystemUiOverlayStyle
typedOther
=
other
;
return
typedO
ther
.
systemNavigationBarColor
==
systemNavigationBarColor
&&
typedO
ther
.
systemNavigationBarDividerColor
==
systemNavigationBarDividerColor
&&
typedO
ther
.
statusBarColor
==
statusBarColor
&&
typedO
ther
.
statusBarIconBrightness
==
statusBarIconBrightness
&&
typedO
ther
.
statusBarBrightness
==
statusBarBrightness
&&
typedO
ther
.
systemNavigationBarIconBrightness
==
systemNavigationBarIconBrightness
;
return
other
is
SystemUiOverlayStyle
&&
o
ther
.
systemNavigationBarColor
==
systemNavigationBarColor
&&
o
ther
.
systemNavigationBarDividerColor
==
systemNavigationBarDividerColor
&&
o
ther
.
statusBarColor
==
statusBarColor
&&
o
ther
.
statusBarIconBrightness
==
statusBarIconBrightness
&&
o
ther
.
statusBarBrightness
==
statusBarBrightness
&&
o
ther
.
systemNavigationBarIconBrightness
==
systemNavigationBarIconBrightness
;
}
}
...
...
packages/flutter/lib/src/services/text_editing.dart
View file @
1c7a1c38
...
...
@@ -101,13 +101,11 @@ class TextSelection extends TextRange {
bool
operator
==(
dynamic
other
)
{
if
(
identical
(
this
,
other
))
return
true
;
if
(
other
is
!
TextSelection
)
return
false
;
final
TextSelection
typedOther
=
other
;
return
typedOther
.
baseOffset
==
baseOffset
&&
typedOther
.
extentOffset
==
extentOffset
&&
typedOther
.
affinity
==
affinity
&&
typedOther
.
isDirectional
==
isDirectional
;
return
other
is
TextSelection
&&
other
.
baseOffset
==
baseOffset
&&
other
.
extentOffset
==
extentOffset
&&
other
.
affinity
==
affinity
&&
other
.
isDirectional
==
isDirectional
;
}
@override
...
...
packages/flutter/lib/src/services/text_input.dart
View file @
1c7a1c38
...
...
@@ -142,12 +142,10 @@ class TextInputType {
@override
bool
operator
==(
dynamic
other
)
{
if
(
other
is
!
TextInputType
)
return
false
;
final
TextInputType
typedOther
=
other
;
return
typedOther
.
index
==
index
&&
typedOther
.
signed
==
signed
&&
typedOther
.
decimal
==
decimal
;
return
other
is
TextInputType
&&
other
.
index
==
index
&&
other
.
signed
==
signed
&&
other
.
decimal
==
decimal
;
}
@override
...
...
@@ -529,16 +527,16 @@ class TextEditingValue {
/// Creates an instance of this class from a JSON object.
factory
TextEditingValue
.
fromJSON
(
Map
<
String
,
dynamic
>
encoded
)
{
return
TextEditingValue
(
text:
encoded
[
'text'
],
text:
encoded
[
'text'
]
as
String
,
selection:
TextSelection
(
baseOffset:
encoded
[
'selectionBase'
]
??
-
1
,
extentOffset:
encoded
[
'selectionExtent'
]
??
-
1
,
affinity:
_toTextAffinity
(
encoded
[
'selectionAffinity'
])
??
TextAffinity
.
downstream
,
isDirectional:
encoded
[
'selectionIsDirectional'
]
??
false
,
baseOffset:
encoded
[
'selectionBase'
]
as
int
??
-
1
,
extentOffset:
encoded
[
'selectionExtent'
]
as
int
??
-
1
,
affinity:
_toTextAffinity
(
encoded
[
'selectionAffinity'
]
as
String
)
??
TextAffinity
.
downstream
,
isDirectional:
encoded
[
'selectionIsDirectional'
]
as
bool
??
false
,
),
composing:
TextRange
(
start:
encoded
[
'composingBase'
]
??
-
1
,
end:
encoded
[
'composingExtent'
]
??
-
1
,
start:
encoded
[
'composingBase'
]
as
int
??
-
1
,
end:
encoded
[
'composingExtent'
]
as
int
??
-
1
,
),
);
}
...
...
@@ -588,12 +586,10 @@ class TextEditingValue {
bool
operator
==(
dynamic
other
)
{
if
(
identical
(
this
,
other
))
return
true
;
if
(
other
is
!
TextEditingValue
)
return
false
;
final
TextEditingValue
typedOther
=
other
;
return
typedOther
.
text
==
text
&&
typedOther
.
selection
==
selection
&&
typedOther
.
composing
==
composing
;
return
other
is
TextEditingValue
&&
other
.
text
==
text
&&
other
.
selection
==
selection
&&
other
.
composing
==
composing
;
}
@override
...
...
@@ -820,7 +816,9 @@ RawFloatingCursorPoint _toTextPoint(FloatingCursorDragState state, Map<String, d
assert
(
state
!=
null
,
'You must provide a state to set a new editing point.'
);
assert
(
encoded
[
'X'
]
!=
null
,
'You must provide a value for the horizontal location of the floating cursor.'
);
assert
(
encoded
[
'Y'
]
!=
null
,
'You must provide a value for the vertical location of the floating cursor.'
);
final
Offset
offset
=
state
==
FloatingCursorDragState
.
Update
?
Offset
(
encoded
[
'X'
],
encoded
[
'Y'
])
:
const
Offset
(
0
,
0
);
final
Offset
offset
=
state
==
FloatingCursorDragState
.
Update
?
Offset
(
encoded
[
'X'
]
as
double
,
encoded
[
'Y'
]
as
double
)
:
const
Offset
(
0
,
0
);
return
RawFloatingCursorPoint
(
offset:
offset
,
state:
state
);
}
...
...
@@ -952,20 +950,23 @@ class TextInput {
return
;
}
final
List
<
dynamic
>
args
=
methodCall
.
arguments
;
final
int
client
=
args
[
0
];
final
List
<
dynamic
>
args
=
methodCall
.
arguments
as
List
<
dynamic
>
;
final
int
client
=
args
[
0
]
as
int
;
// The incoming message was for a different client.
if
(
client
!=
_currentConnection
.
_id
)
return
;
switch
(
method
)
{
case
'TextInputClient.updateEditingState'
:
_currentConnection
.
_client
.
updateEditingValue
(
TextEditingValue
.
fromJSON
(
args
[
1
]));
_currentConnection
.
_client
.
updateEditingValue
(
TextEditingValue
.
fromJSON
(
args
[
1
]
as
Map
<
String
,
dynamic
>
));
break
;
case
'TextInputClient.performAction'
:
_currentConnection
.
_client
.
performAction
(
_toTextInputAction
(
args
[
1
]));
_currentConnection
.
_client
.
performAction
(
_toTextInputAction
(
args
[
1
]
as
String
));
break
;
case
'TextInputClient.updateFloatingCursor'
:
_currentConnection
.
_client
.
updateFloatingCursor
(
_toTextPoint
(
_toTextCursorAction
(
args
[
1
]),
args
[
2
]));
_currentConnection
.
_client
.
updateFloatingCursor
(
_toTextPoint
(
_toTextCursorAction
(
args
[
1
]
as
String
),
args
[
2
]
as
Map
<
String
,
dynamic
>,
));
break
;
case
'TextInputClient.onConnectionClosed'
:
_currentConnection
.
_client
.
connectionClosed
();
...
...
packages/flutter/test/services/platform_channel_test.dart
View file @
1c7a1c38
...
...
@@ -69,7 +69,7 @@ void main() {
}
},
);
expect
(
channel
.
invokeMethod
<
List
<
String
>>(
'sayHello'
,
'hello'
),
throwsA
(
isInstanceOf
<
Type
Error
>()));
expect
(
channel
.
invokeMethod
<
List
<
String
>>(
'sayHello'
,
'hello'
),
throwsA
(
isInstanceOf
<
Cast
Error
>()));
expect
(
await
channel
.
invokeListMethod
<
String
>(
'sayHello'
,
'hello'
),
<
String
>[
'hello'
,
'world'
]);
});
...
...
@@ -101,7 +101,7 @@ void main() {
}
},
);
expect
(
channel
.
invokeMethod
<
Map
<
String
,
String
>>(
'sayHello'
,
'hello'
),
throwsA
(
isInstanceOf
<
Type
Error
>()));
expect
(
channel
.
invokeMethod
<
Map
<
String
,
String
>>(
'sayHello'
,
'hello'
),
throwsA
(
isInstanceOf
<
Cast
Error
>()));
expect
(
await
channel
.
invokeMapMethod
<
String
,
String
>(
'sayHello'
,
'hello'
),
<
String
,
String
>{
'hello'
:
'world'
});
});
...
...
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