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
3c77c432
Unverified
Commit
3c77c432
authored
Feb 17, 2021
by
Ren You
Committed by
GitHub
Feb 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Remove some `dynamic's. (#75820)" (#76232)
This reverts commit
2d9a01a8
.
parent
3cbe0ff1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
88 deletions
+66
-88
message_codec.dart
packages/flutter/lib/src/services/message_codec.dart
+4
-10
message_codecs.dart
packages/flutter/lib/src/services/message_codecs.dart
+41
-57
platform_channel.dart
packages/flutter/lib/src/services/platform_channel.dart
+3
-3
restoration.dart
packages/flutter/lib/src/services/restoration.dart
+15
-15
message_codecs_testing.dart
packages/flutter/test/services/message_codecs_testing.dart
+2
-2
plugin_registry_test.dart
packages/flutter_web_plugins/test/plugin_registry_test.dart
+1
-1
No files found.
packages/flutter/lib/src/services/message_codec.dart
View file @
3c77c432
...
...
@@ -29,7 +29,7 @@ abstract class MessageCodec<T> {
/// Decodes the specified [message] from binary.
///
/// Returns null if the message is null.
T
?
decodeMessage
(
ByteData
?
message
);
T
decodeMessage
(
ByteData
?
message
);
}
/// An command object representing the invocation of a named method.
...
...
@@ -73,22 +73,16 @@ abstract class MethodCodec {
///
/// Throws [PlatformException], if [envelope] represents an error, otherwise
/// returns the enveloped result.
///
/// The type returned from [decodeEnvelope] is `dynamic` (not `Object?`),
/// which means *no type checking is performed on its return value*. It is
/// strongly recommended that the return value be immediately cast to a known
/// type to prevent runtime errors due to typos that the type checker could
/// otherwise catch.
dynamic
decodeEnvelope
(
ByteData
envelope
);
/// Encodes a successful [result] into a binary envelope.
ByteData
encodeSuccessEnvelope
(
Object
?
result
);
ByteData
encodeSuccessEnvelope
(
dynamic
result
);
/// Encodes an error result into a binary envelope.
///
/// The specified error [code], human-readable error [message] and error
/// [details] correspond to the fields of [PlatformException].
ByteData
encodeErrorEnvelope
({
required
String
code
,
String
?
message
,
Object
?
details
});
ByteData
encodeErrorEnvelope
({
required
String
code
,
String
?
message
,
dynamic
details
});
}
...
...
@@ -123,7 +117,7 @@ class PlatformException implements Exception {
final
String
?
message
;
/// Error details, possibly null.
final
Object
?
details
;
final
dynamic
details
;
/// Native stacktrace for the error, possibly null.
/// This is strictly for native platform stacktrace.
...
...
packages/flutter/lib/src/services/message_codecs.dart
View file @
3c77c432
...
...
@@ -17,7 +17,7 @@ import 'message_codec.dart';
/// When sending outgoing messages from Android, be sure to use direct `ByteBuffer`
/// as opposed to indirect. The `wrap()` API provides indirect buffers by default
/// and you will get empty `ByteData` objects in Dart.
class
BinaryCodec
implements
MessageCodec
<
ByteData
>
{
class
BinaryCodec
implements
MessageCodec
<
ByteData
?
>
{
/// Creates a [MessageCodec] with unencoded binary messages represented using
/// [ByteData].
const
BinaryCodec
();
...
...
@@ -33,7 +33,7 @@ class BinaryCodec implements MessageCodec<ByteData> {
///
/// On Android, messages will be represented using `java.util.String`.
/// On iOS, messages will be represented using `NSString`.
class
StringCodec
implements
MessageCodec
<
String
>
{
class
StringCodec
implements
MessageCodec
<
String
?
>
{
/// Creates a [MessageCodec] with UTF-8 encoded String messages.
const
StringCodec
();
...
...
@@ -71,13 +71,7 @@ class StringCodec implements MessageCodec<String> {
/// null/nil for null, and identical to what would result from decoding a
/// singleton JSON array with a Boolean, number, or string value, and then
/// extracting its single element.
///
/// The type returned from [decodeMessage] is `dynamic` (not `Object?`), which
/// means *no type checking is performed on its return value*. It is strongly
/// recommended that the return value be immediately cast to a known type to
/// prevent runtime errors due to typos that the type checker could otherwise
/// catch.
class
JSONMessageCodec
implements
MessageCodec
<
Object
?>
{
class
JSONMessageCodec
implements
MessageCodec
<
dynamic
>
{
// The codec serializes messages as defined by the JSON codec of the
// dart:convert package. The format used must match the Android and
// iOS counterparts.
...
...
@@ -86,7 +80,7 @@ class JSONMessageCodec implements MessageCodec<Object?> {
const
JSONMessageCodec
();
@override
ByteData
?
encodeMessage
(
Object
?
message
)
{
ByteData
?
encodeMessage
(
dynamic
message
)
{
if
(
message
==
null
)
return
null
;
return
const
StringCodec
().
encodeMessage
(
json
.
encode
(
message
));
...
...
@@ -124,7 +118,7 @@ class JSONMethodCodec implements MethodCodec {
@override
ByteData
encodeMethodCall
(
MethodCall
call
)
{
return
const
JSONMessageCodec
().
encodeMessage
(<
String
,
Object
?
>{
return
const
JSONMessageCodec
().
encodeMessage
(<
String
,
dynamic
>{
'method'
:
call
.
method
,
'args'
:
call
.
arguments
,
})!;
...
...
@@ -132,11 +126,11 @@ class JSONMethodCodec implements MethodCodec {
@override
MethodCall
decodeMethodCall
(
ByteData
?
methodCall
)
{
final
Object
?
decoded
=
const
JSONMessageCodec
().
decodeMessage
(
methodCall
);
final
dynamic
decoded
=
const
JSONMessageCodec
().
decodeMessage
(
methodCall
);
if
(
decoded
is
!
Map
)
throw
FormatException
(
'Expected method call Map, got
$decoded
'
);
final
Object
?
method
=
decoded
[
'method'
];
final
Object
?
arguments
=
decoded
[
'args'
];
final
dynamic
method
=
decoded
[
'method'
];
final
dynamic
arguments
=
decoded
[
'args'
];
if
(
method
is
String
)
return
MethodCall
(
method
,
arguments
);
throw
FormatException
(
'Invalid method call:
$decoded
'
);
...
...
@@ -144,7 +138,7 @@ class JSONMethodCodec implements MethodCodec {
@override
dynamic
decodeEnvelope
(
ByteData
envelope
)
{
final
Object
?
decoded
=
const
JSONMessageCodec
().
decodeMessage
(
envelope
);
final
dynamic
decoded
=
const
JSONMessageCodec
().
decodeMessage
(
envelope
);
if
(
decoded
is
!
List
)
throw
FormatException
(
'Expected envelope List, got
$decoded
'
);
if
(
decoded
.
length
==
1
)
...
...
@@ -171,14 +165,14 @@ class JSONMethodCodec implements MethodCodec {
}
@override
ByteData
encodeSuccessEnvelope
(
Object
?
result
)
{
return
const
JSONMessageCodec
().
encodeMessage
(<
Object
?
>[
result
])!;
ByteData
encodeSuccessEnvelope
(
dynamic
result
)
{
return
const
JSONMessageCodec
().
encodeMessage
(<
dynamic
>[
result
])!;
}
@override
ByteData
encodeErrorEnvelope
({
required
String
code
,
String
?
message
,
Object
?
details
})
{
ByteData
encodeErrorEnvelope
({
required
String
code
,
String
?
message
,
dynamic
details
})
{
assert
(
code
!=
null
);
return
const
JSONMessageCodec
().
encodeMessage
(<
Object
?
>[
code
,
message
,
details
])!;
return
const
JSONMessageCodec
().
encodeMessage
(<
dynamic
>[
code
,
message
,
details
])!;
}
}
...
...
@@ -194,20 +188,9 @@ class JSONMethodCodec implements MethodCodec {
/// * [List]s of supported values
/// * [Map]s from supported values to supported values
///
/// Decoded values will use `List<
Object?>` and `Map<Object?, Object?
>`
/// Decoded values will use `List<
dynamic>` and `Map<dynamic, dynamic
>`
/// irrespective of content.
///
/// The type returned from [decodeMessage] is `dynamic` (not `Object?`), which
/// means *no type checking is performed on its return value*. It is strongly
/// recommended that the return value be immediately cast to a known type to
/// prevent runtime errors due to typos that the type checker could otherwise
/// catch.
///
/// The codec is extensible by subclasses overriding [writeValue] and
/// [readValueOfType].
///
/// ## Android specifics
///
/// On Android, messages are represented as follows:
///
/// * null: null
...
...
@@ -223,14 +206,6 @@ class JSONMethodCodec implements MethodCodec {
/// * [List]\: `java.util.ArrayList`
/// * [Map]\: `java.util.HashMap`
///
/// When sending a `java.math.BigInteger` from Java, it is converted into a
/// [String] with the hexadecimal representation of the integer. (The value is
/// tagged as being a big integer; subclasses of this class could be made to
/// support it natively; see the discussion at [writeValue].) This codec does
/// not support sending big integers from Dart.
///
/// ## iOS specifics
///
/// On iOS, messages are represented as follows:
///
/// * null: nil
...
...
@@ -243,7 +218,16 @@ class JSONMethodCodec implements MethodCodec {
/// `FlutterStandardTypedData`
/// * [List]\: `NSArray`
/// * [Map]\: `NSDictionary`
class
StandardMessageCodec
implements
MessageCodec
<
Object
?>
{
///
/// When sending a `java.math.BigInteger` from Java, it is converted into a
/// [String] with the hexadecimal representation of the integer. (The value is
/// tagged as being a big integer; subclasses of this class could be made to
/// support it natively; see the discussion at [writeValue].) This codec does
/// not support sending big integers from Dart.
///
/// The codec is extensible by subclasses overriding [writeValue] and
/// [readValueOfType].
class
StandardMessageCodec
implements
MessageCodec
<
dynamic
>
{
/// Creates a [MessageCodec] using the Flutter standard binary encoding.
const
StandardMessageCodec
();
...
...
@@ -305,7 +289,7 @@ class StandardMessageCodec implements MessageCodec<Object?> {
static
const
int
_valueMap
=
13
;
@override
ByteData
?
encodeMessage
(
Object
?
message
)
{
ByteData
?
encodeMessage
(
dynamic
message
)
{
if
(
message
==
null
)
return
null
;
final
WriteBuffer
buffer
=
WriteBuffer
();
...
...
@@ -318,7 +302,7 @@ class StandardMessageCodec implements MessageCodec<Object?> {
if
(
message
==
null
)
return
null
;
final
ReadBuffer
buffer
=
ReadBuffer
(
message
);
final
Object
?
result
=
readValue
(
buffer
);
final
dynamic
result
=
readValue
(
buffer
);
if
(
buffer
.
hasRemaining
)
throw
const
FormatException
(
'Message corrupted'
);
return
result
;
...
...
@@ -360,7 +344,7 @@ class StandardMessageCodec implements MessageCodec<Object?> {
/// string's length as encoded by [writeSize] followed by the string bytes. On
/// Android, that would get converted to a `java.math.BigInteger` object. On
/// iOS, the string representation is returned.
void
writeValue
(
WriteBuffer
buffer
,
Object
?
value
)
{
void
writeValue
(
WriteBuffer
buffer
,
dynamic
value
)
{
if
(
value
==
null
)
{
buffer
.
putUint8
(
_valueNull
);
}
else
if
(
value
is
bool
)
{
...
...
@@ -405,13 +389,13 @@ class StandardMessageCodec implements MessageCodec<Object?> {
}
else
if
(
value
is
List
)
{
buffer
.
putUint8
(
_valueList
);
writeSize
(
buffer
,
value
.
length
);
for
(
final
Object
?
item
in
value
)
{
for
(
final
dynamic
item
in
value
)
{
writeValue
(
buffer
,
item
);
}
}
else
if
(
value
is
Map
)
{
buffer
.
putUint8
(
_valueMap
);
writeSize
(
buffer
,
value
.
length
);
value
.
forEach
((
Object
?
key
,
Object
?
value
)
{
value
.
forEach
((
dynamic
key
,
dynamic
value
)
{
writeValue
(
buffer
,
key
);
writeValue
(
buffer
,
value
);
});
...
...
@@ -424,7 +408,7 @@ class StandardMessageCodec implements MessageCodec<Object?> {
///
/// This method is intended for use by subclasses overriding
/// [readValueOfType].
Object
?
readValue
(
ReadBuffer
buffer
)
{
dynamic
readValue
(
ReadBuffer
buffer
)
{
if
(!
buffer
.
hasRemaining
)
throw
const
FormatException
(
'Message corrupted'
);
final
int
type
=
buffer
.
getUint8
();
...
...
@@ -436,7 +420,7 @@ class StandardMessageCodec implements MessageCodec<Object?> {
/// The codec can be extended by overriding this method, calling super for
/// types that the extension does not handle. See the discussion at
/// [writeValue].
Object
?
readValueOfType
(
int
type
,
ReadBuffer
buffer
)
{
dynamic
readValueOfType
(
int
type
,
ReadBuffer
buffer
)
{
switch
(
type
)
{
case
_valueNull:
return
null
;
...
...
@@ -468,13 +452,13 @@ class StandardMessageCodec implements MessageCodec<Object?> {
return
buffer
.
getFloat64List
(
length
);
case
_valueList:
final
int
length
=
readSize
(
buffer
);
final
List
<
Object
?>
result
=
List
<
Object
?
>.
filled
(
length
,
null
,
growable:
false
);
final
List
<
dynamic
>
result
=
List
<
dynamic
>.
filled
(
length
,
null
,
growable:
false
);
for
(
int
i
=
0
;
i
<
length
;
i
++)
result
[
i
]
=
readValue
(
buffer
);
return
result
;
case
_valueMap:
final
int
length
=
readSize
(
buffer
);
final
Map
<
Object
?,
Object
?>
result
=
<
Object
?,
Object
?
>{};
final
Map
<
dynamic
,
dynamic
>
result
=
<
dynamic
,
dynamic
>{};
for
(
int
i
=
0
;
i
<
length
;
i
++)
result
[
readValue
(
buffer
)]
=
readValue
(
buffer
);
return
result
;
...
...
@@ -555,8 +539,8 @@ class StandardMethodCodec implements MethodCodec {
@override
MethodCall
decodeMethodCall
(
ByteData
?
methodCall
)
{
final
ReadBuffer
buffer
=
ReadBuffer
(
methodCall
!);
final
Object
?
method
=
messageCodec
.
readValue
(
buffer
);
final
Object
?
arguments
=
messageCodec
.
readValue
(
buffer
);
final
dynamic
method
=
messageCodec
.
readValue
(
buffer
);
final
dynamic
arguments
=
messageCodec
.
readValue
(
buffer
);
if
(
method
is
String
&&
!
buffer
.
hasRemaining
)
return
MethodCall
(
method
,
arguments
);
else
...
...
@@ -564,7 +548,7 @@ class StandardMethodCodec implements MethodCodec {
}
@override
ByteData
encodeSuccessEnvelope
(
Object
?
result
)
{
ByteData
encodeSuccessEnvelope
(
dynamic
result
)
{
final
WriteBuffer
buffer
=
WriteBuffer
();
buffer
.
putUint8
(
0
);
messageCodec
.
writeValue
(
buffer
,
result
);
...
...
@@ -572,7 +556,7 @@ class StandardMethodCodec implements MethodCodec {
}
@override
ByteData
encodeErrorEnvelope
({
required
String
code
,
String
?
message
,
Object
?
details
})
{
ByteData
encodeErrorEnvelope
({
required
String
code
,
String
?
message
,
dynamic
details
})
{
final
WriteBuffer
buffer
=
WriteBuffer
();
buffer
.
putUint8
(
1
);
messageCodec
.
writeValue
(
buffer
,
code
);
...
...
@@ -589,10 +573,10 @@ class StandardMethodCodec implements MethodCodec {
final
ReadBuffer
buffer
=
ReadBuffer
(
envelope
);
if
(
buffer
.
getUint8
()
==
0
)
return
messageCodec
.
readValue
(
buffer
);
final
Object
?
errorCode
=
messageCodec
.
readValue
(
buffer
);
final
Object
?
errorMessage
=
messageCodec
.
readValue
(
buffer
);
final
Object
?
errorDetails
=
messageCodec
.
readValue
(
buffer
);
final
String
?
errorStacktrace
=
(
buffer
.
hasRemaining
)
?
messageCodec
.
readValue
(
buffer
)
as
String
?
:
null
;
final
dynamic
errorCode
=
messageCodec
.
readValue
(
buffer
);
final
dynamic
errorMessage
=
messageCodec
.
readValue
(
buffer
);
final
dynamic
errorDetails
=
messageCodec
.
readValue
(
buffer
);
final
String
?
errorStacktrace
=
(
buffer
.
hasRemaining
)
?
messageCodec
.
readValue
(
buffer
)
as
String
:
null
;
if
(
errorCode
is
String
&&
(
errorMessage
==
null
||
errorMessage
is
String
)
&&
!
buffer
.
hasRemaining
)
throw
PlatformException
(
code:
errorCode
,
message:
errorMessage
as
String
?,
details:
errorDetails
,
stacktrace:
errorStacktrace
);
else
...
...
packages/flutter/lib/src/services/platform_channel.dart
View file @
3c77c432
...
...
@@ -52,7 +52,7 @@ class BasicMessageChannel<T> {
///
/// Returns a [Future] which completes to the received response, which may
/// be null.
Future
<
T
?
>
send
(
T
message
)
async
{
Future
<
T
>
send
(
T
message
)
async
{
return
codec
.
decodeMessage
(
await
binaryMessenger
.
send
(
name
,
codec
.
encodeMessage
(
message
)));
}
...
...
@@ -65,7 +65,7 @@ class BasicMessageChannel<T> {
///
/// The handler's return value is sent back to the platform plugins as a
/// message reply. It may be null.
void
setMessageHandler
(
Future
<
T
>
Function
(
T
?
message
)?
handler
)
{
void
setMessageHandler
(
Future
<
T
>
Function
(
T
message
)?
handler
)
{
if
(
handler
==
null
)
{
binaryMessenger
.
setMessageHandler
(
name
,
null
);
}
else
{
...
...
@@ -86,7 +86,7 @@ class BasicMessageChannel<T> {
///
/// This is intended for testing. Messages intercepted in this manner are not
/// sent to platform plugins.
void
setMockMessageHandler
(
Future
<
T
>
Function
(
T
?
message
)?
handler
)
{
void
setMockMessageHandler
(
Future
<
T
>
Function
(
T
message
)?
handler
)
{
if
(
handler
==
null
)
{
binaryMessenger
.
setMockMessageHandler
(
name
,
null
);
}
else
{
...
...
packages/flutter/lib/src/services/restoration.dart
View file @
3c77c432
...
...
@@ -226,7 +226,7 @@ class RestorationManager extends ChangeNotifier {
bool
_isReplacing
=
false
;
Future
<
void
>
_getRootBucketFromEngine
()
async
{
final
Map
<
Object
?,
Object
?>?
config
=
await
SystemChannels
.
restoration
.
invokeMethod
<
Map
<
Object
?,
Object
?
>>(
'get'
);
final
Map
<
dynamic
,
dynamic
>?
config
=
await
SystemChannels
.
restoration
.
invokeMethod
<
Map
<
dynamic
,
dynamic
>>(
'get'
);
if
(
_pendingRootBucket
==
null
)
{
// The restoration data was obtained via other means (e.g. by calling
// [handleRestorationDataUpdate] while the request to the engine was
...
...
@@ -237,9 +237,9 @@ class RestorationManager extends ChangeNotifier {
_parseAndHandleRestorationUpdateFromEngine
(
config
);
}
void
_parseAndHandleRestorationUpdateFromEngine
(
Map
<
Object
?,
Object
?
>?
update
)
{
void
_parseAndHandleRestorationUpdateFromEngine
(
Map
<
dynamic
,
dynamic
>?
update
)
{
handleRestorationUpdateFromEngine
(
enabled:
update
!=
null
&&
update
[
'enabled'
]
!
as
bool
,
enabled:
update
!=
null
&&
update
[
'enabled'
]
as
bool
,
data:
update
==
null
?
null
:
update
[
'data'
]
as
Uint8List
?,
);
}
...
...
@@ -305,25 +305,25 @@ class RestorationManager extends ChangeNotifier {
);
}
Future
<
Object
?
>
_methodHandler
(
MethodCall
call
)
async
{
Future
<
dynamic
>
_methodHandler
(
MethodCall
call
)
async
{
switch
(
call
.
method
)
{
case
'push'
:
_parseAndHandleRestorationUpdateFromEngine
(
call
.
arguments
as
Map
<
Object
?,
Object
?
>);
_parseAndHandleRestorationUpdateFromEngine
(
call
.
arguments
as
Map
<
dynamic
,
dynamic
>);
break
;
default
:
throw
UnimplementedError
(
"
${call.method}
was invoked but isn't implemented by
$runtimeType
"
);
}
}
Map
<
Object
?,
Object
?
>?
_decodeRestorationData
(
Uint8List
?
data
)
{
Map
<
dynamic
,
dynamic
>?
_decodeRestorationData
(
Uint8List
?
data
)
{
if
(
data
==
null
)
{
return
null
;
}
final
ByteData
encoded
=
data
.
buffer
.
asByteData
(
data
.
offsetInBytes
,
data
.
lengthInBytes
);
return
const
StandardMessageCodec
().
decodeMessage
(
encoded
)
as
Map
<
Object
?,
Object
?>?
;
return
const
StandardMessageCodec
().
decodeMessage
(
encoded
)
as
Map
<
dynamic
,
dynamic
>
;
}
Uint8List
_encodeRestorationData
(
Map
<
Object
?,
Object
?
>
data
)
{
Uint8List
_encodeRestorationData
(
Map
<
dynamic
,
dynamic
>
data
)
{
final
ByteData
encoded
=
const
StandardMessageCodec
().
encodeMessage
(
data
)!;
return
encoded
.
buffer
.
asUint8List
(
encoded
.
offsetInBytes
,
encoded
.
lengthInBytes
);
}
...
...
@@ -505,7 +505,7 @@ class RestorationBucket {
required
Object
?
debugOwner
,
})
:
assert
(
restorationId
!=
null
),
_restorationId
=
restorationId
,
_rawData
=
<
String
,
Object
?
>{}
{
_rawData
=
<
String
,
dynamic
>{}
{
assert
(()
{
_debugOwner
=
debugOwner
;
return
true
;
...
...
@@ -537,10 +537,10 @@ class RestorationBucket {
/// The `manager` argument must not be null.
RestorationBucket
.
root
({
required
RestorationManager
manager
,
required
Map
<
Object
?,
Object
?
>?
rawData
,
required
Map
<
dynamic
,
dynamic
>?
rawData
,
})
:
assert
(
manager
!=
null
),
_manager
=
manager
,
_rawData
=
rawData
??
<
Object
?,
Object
?
>{},
_rawData
=
rawData
??
<
dynamic
,
dynamic
>{},
_restorationId
=
'root'
{
assert
(()
{
_debugOwner
=
manager
;
...
...
@@ -567,7 +567,7 @@ class RestorationBucket {
assert
(
parent
.
_rawChildren
[
restorationId
]
!=
null
),
_manager
=
parent
.
_manager
,
_parent
=
parent
,
_rawData
=
parent
.
_rawChildren
[
restorationId
]
!
as
Map
<
Object
?,
Object
?
>,
_rawData
=
parent
.
_rawChildren
[
restorationId
]
as
Map
<
dynamic
,
dynamic
>,
_restorationId
=
restorationId
{
assert
(()
{
_debugOwner
=
debugOwner
;
...
...
@@ -578,7 +578,7 @@ class RestorationBucket {
static
const
String
_childrenMapKey
=
'c'
;
static
const
String
_valuesMapKey
=
'v'
;
final
Map
<
Object
?,
Object
?
>
_rawData
;
final
Map
<
dynamic
,
dynamic
>
_rawData
;
/// The owner of the bucket that was provided when the bucket was claimed via
/// [claimChild].
...
...
@@ -616,9 +616,9 @@ class RestorationBucket {
String
_restorationId
;
// Maps a restoration ID to the raw map representation of a child bucket.
Map
<
Object
?,
Object
?>
get
_rawChildren
=>
_rawData
.
putIfAbsent
(
_childrenMapKey
,
()
=>
<
Object
?,
Object
?>{})!
as
Map
<
Object
?,
Object
?
>;
Map
<
dynamic
,
dynamic
>
get
_rawChildren
=>
_rawData
.
putIfAbsent
(
_childrenMapKey
,
()
=>
<
dynamic
,
dynamic
>{})
as
Map
<
dynamic
,
dynamic
>;
// Maps a restoration ID to a value that is stored in this bucket.
Map
<
Object
?,
Object
?>
get
_rawValues
=>
_rawData
.
putIfAbsent
(
_valuesMapKey
,
()
=>
<
Object
?,
Object
?>{})!
as
Map
<
Object
?,
Object
?
>;
Map
<
dynamic
,
dynamic
>
get
_rawValues
=>
_rawData
.
putIfAbsent
(
_valuesMapKey
,
()
=>
<
dynamic
,
dynamic
>{})
as
Map
<
dynamic
,
dynamic
>;
// Get and store values.
...
...
packages/flutter/test/services/message_codecs_testing.dart
View file @
3c77c432
...
...
@@ -17,13 +17,13 @@ void checkEncoding<T>(MessageCodec<T> codec, T message, List<int> expectedBytes)
void
checkEncodeDecode
<
T
>(
MessageCodec
<
T
>
codec
,
T
message
)
{
final
ByteData
?
encoded
=
codec
.
encodeMessage
(
message
);
final
T
?
decoded
=
codec
.
decodeMessage
(
encoded
);
final
T
decoded
=
codec
.
decodeMessage
(
encoded
);
if
(
message
==
null
)
{
expect
(
encoded
,
isNull
);
expect
(
decoded
,
isNull
);
}
else
{
expect
(
deepEquals
(
message
,
decoded
),
isTrue
);
final
ByteData
?
encodedAgain
=
codec
.
encodeMessage
(
decoded
as
T
);
final
ByteData
?
encodedAgain
=
codec
.
encodeMessage
(
decoded
);
expect
(
encodedAgain
!.
buffer
.
asUint8List
(),
orderedEquals
(
encoded
!.
buffer
.
asUint8List
()),
...
...
packages/flutter_web_plugins/test/plugin_registry_test.dart
View file @
3c77c432
...
...
@@ -56,7 +56,7 @@ void main() {
final
List
<
String
>
loggedMessages
=
<
String
>[];
ServicesBinding
.
instance
!.
defaultBinaryMessenger
.
setMessageHandler
(
'test_send'
,
(
ByteData
?
data
)
{
loggedMessages
.
add
(
codec
.
decodeMessage
(
data
)
!
as
String
);
loggedMessages
.
add
(
codec
.
decodeMessage
(
data
)
as
String
);
return
Future
<
ByteData
?>.
value
(
null
);
});
...
...
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