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
164671e2
Unverified
Commit
164671e2
authored
Jan 28, 2021
by
Kate Lovett
Committed by
GitHub
Jan 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated BinaryMessages (#73750)
parent
51b3edd4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
146 deletions
+5
-146
services.dart
packages/flutter/lib/services.dart
+0
-1
asset_bundle.dart
packages/flutter/lib/src/services/asset_bundle.dart
+2
-2
binary_messenger.dart
packages/flutter/lib/src/services/binary_messenger.dart
+0
-34
platform_channel.dart
packages/flutter/lib/src/services/platform_channel.dart
+3
-3
platform_messages.dart
packages/flutter/lib/src/services/platform_messages.dart
+0
-106
No files found.
packages/flutter/lib/services.dart
View file @
164671e2
...
...
@@ -23,7 +23,6 @@ export 'src/services/keyboard_maps.dart';
export
'src/services/message_codec.dart'
;
export
'src/services/message_codecs.dart'
;
export
'src/services/platform_channel.dart'
;
export
'src/services/platform_messages.dart'
;
export
'src/services/platform_views.dart'
;
export
'src/services/raw_keyboard.dart'
;
export
'src/services/raw_keyboard_android.dart'
;
...
...
packages/flutter/lib/src/services/asset_bundle.dart
View file @
164671e2
...
...
@@ -10,7 +10,7 @@ import 'dart:typed_data';
import
'package:flutter/foundation.dart'
;
import
'bin
ary_messenger
.dart'
;
import
'bin
ding
.dart'
;
/// A collection of resources used by the application.
///
...
...
@@ -222,7 +222,7 @@ class PlatformAssetBundle extends CachingAssetBundle {
Future
<
ByteData
>
load
(
String
key
)
async
{
final
Uint8List
encoded
=
utf8
.
encoder
.
convert
(
Uri
(
path:
Uri
.
encodeFull
(
key
)).
path
);
final
ByteData
?
asset
=
await
defaultBinaryMessenger
.
send
(
'flutter/assets'
,
encoded
.
buffer
.
asByteData
());
await
ServicesBinding
.
instance
!.
defaultBinaryMessenger
.
send
(
'flutter/assets'
,
encoded
.
buffer
.
asByteData
());
if
(
asset
==
null
)
throw
FlutterError
(
'Unable to load asset:
$key
'
);
return
asset
;
...
...
packages/flutter/lib/src/services/binary_messenger.dart
View file @
164671e2
...
...
@@ -6,7 +6,6 @@
import
'dart:typed_data'
;
import
'dart:ui'
as
ui
;
import
'package:flutter/foundation.dart'
;
import
'binding.dart'
;
/// A function which takes a platform message and asynchronously returns an encoded response.
...
...
@@ -77,36 +76,3 @@ abstract class BinaryMessenger {
/// `channel` is not set.
bool
checkMockMessageHandler
(
String
channel
,
MessageHandler
?
handler
);
}
/// The default instance of [BinaryMessenger].
///
/// This API has been deprecated in favor of [ServicesBinding.defaultBinaryMessenger].
/// Please use [ServicesBinding.defaultBinaryMessenger] as the default
/// instance of [BinaryMessenger].
///
/// This is used to send messages from the application to the platform, and
/// keeps track of which handlers have been registered on each channel so
/// it may dispatch incoming messages to the registered handler.
@Deprecated
(
'Use ServicesBinding.instance.defaultBinaryMessenger instead. '
'This feature was deprecated after v1.6.5.'
)
BinaryMessenger
get
defaultBinaryMessenger
{
assert
(()
{
if
(
ServicesBinding
.
instance
==
null
)
{
throw
FlutterError
(
'ServicesBinding.defaultBinaryMessenger was accessed before the '
'binding was initialized.
\n
'
"If you're running an application and need to access the binary "
'messenger before `runApp()` has been called (for example, during '
'plugin initialization), then you need to explicitly call the '
'`WidgetsFlutterBinding.ensureInitialized()` first.
\n
'
"If you're running a test, you can call the "
'`TestWidgetsFlutterBinding.ensureInitialized()` as the first line in '
"your test's `main()` method to initialize the binding."
);
}
return
true
;
}());
return
ServicesBinding
.
instance
!.
defaultBinaryMessenger
;
}
packages/flutter/lib/src/services/platform_channel.dart
View file @
164671e2
...
...
@@ -45,7 +45,7 @@ class BasicMessageChannel<T> {
final
MessageCodec
<
T
>
codec
;
/// The messenger which sends the bytes for this channel, not null.
BinaryMessenger
get
binaryMessenger
=>
_binaryMessenger
??
defaultBinaryMessenger
;
BinaryMessenger
get
binaryMessenger
=>
_binaryMessenger
??
ServicesBinding
.
instance
!.
defaultBinaryMessenger
;
final
BinaryMessenger
?
_binaryMessenger
;
/// Sends the specified [message] to the platform plugins on this channel.
...
...
@@ -139,7 +139,7 @@ class MethodChannel {
/// The messenger used by this channel to send platform messages.
///
/// The messenger may not be null.
BinaryMessenger
get
binaryMessenger
=>
_binaryMessenger
??
defaultBinaryMessenger
;
BinaryMessenger
get
binaryMessenger
=>
_binaryMessenger
??
ServicesBinding
.
instance
!.
defaultBinaryMessenger
;
final
BinaryMessenger
?
_binaryMessenger
;
@optionalTypeArgs
...
...
@@ -509,7 +509,7 @@ class EventChannel {
final
MethodCodec
codec
;
/// The messenger used by this channel to send platform messages, not null.
BinaryMessenger
get
binaryMessenger
=>
_binaryMessenger
??
defaultBinaryMessenger
;
BinaryMessenger
get
binaryMessenger
=>
_binaryMessenger
??
ServicesBinding
.
instance
!.
defaultBinaryMessenger
;
final
BinaryMessenger
?
_binaryMessenger
;
/// Sets up a broadcast stream for receiving events on this channel.
...
...
packages/flutter/lib/src/services/platform_messages.dart
deleted
100644 → 0
View file @
51b3edd4
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:typed_data'
;
import
'dart:ui'
as
ui
;
import
'binary_messenger.dart'
;
import
'platform_channel.dart'
;
/// Sends binary messages to and receives binary messages from platform plugins.
///
/// This class has been deprecated in favor of [defaultBinaryMessenger]. New
/// code should not use [BinaryMessages].
///
/// See also:
///
/// * [BinaryMessenger], the interface which has replaced this class.
/// * [BasicMessageChannel], which provides basic messaging services similar to
/// `BinaryMessages`, but with pluggable message codecs in support of sending
/// strings or semi-structured messages.
/// * [MethodChannel], which provides platform communication using asynchronous
/// method calls.
/// * [EventChannel], which provides platform communication using event streams.
/// * <https://flutter.dev/platform-channels/>
@Deprecated
(
'This class, which was just a collection of static methods, has been '
'deprecated in favor of BinaryMessenger, and its default implementation, '
'defaultBinaryMessenger. '
'This feature was deprecated after v1.6.5.'
)
class
BinaryMessages
{
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
// ignore: unused_element
BinaryMessages
.
_
();
/// The messenger which sends the platform messages, not null.
static
final
BinaryMessenger
_binaryMessenger
=
defaultBinaryMessenger
;
/// Calls the handler registered for the given channel.
///
/// Typically called by [ServicesBinding] to handle platform messages received
/// from [dart:ui.PlatformDispatcher.onPlatformMessage].
///
/// To register a handler for a given message channel, see [setMessageHandler].
@Deprecated
(
'Use defaultBinaryMessenger.handlePlatformMessage instead. '
'This feature was deprecated after v1.6.5.'
)
static
Future
<
void
>
handlePlatformMessage
(
String
channel
,
ByteData
data
,
ui
.
PlatformMessageResponseCallback
callback
,
)
{
return
_binaryMessenger
.
handlePlatformMessage
(
channel
,
data
,
callback
);
}
/// Send a binary message to the platform plugins on the given channel.
///
/// Returns a [Future] which completes to the received response, undecoded, in
/// binary form.
@Deprecated
(
'Use defaultBinaryMessenger.send instead. '
'This feature was deprecated after v1.6.5.'
)
static
Future
<
ByteData
?>?
send
(
String
channel
,
ByteData
?
message
)
{
return
_binaryMessenger
.
send
(
channel
,
message
);
}
/// Set a callback for receiving messages from the platform plugins on the
/// given channel, without decoding them.
///
/// The given callback will replace the currently registered callback for that
/// channel, if any. To remove the handler, pass null as the `handler`
/// argument.
///
/// The handler's return value, if non-null, is sent as a response, unencoded.
@Deprecated
(
'Use defaultBinaryMessenger.setMessageHandler instead. '
'This feature was deprecated after v1.6.5.'
)
static
void
setMessageHandler
(
String
channel
,
Future
<
ByteData
?>
Function
(
ByteData
?
message
)
handler
)
{
_binaryMessenger
.
setMessageHandler
(
channel
,
handler
);
}
/// Set a mock callback for intercepting messages from the `send*` methods on
/// this class, on the given channel, without decoding them.
///
/// The given callback will replace the currently registered mock callback for
/// that channel, if any. To remove the mock handler, pass null as the
/// `handler` argument.
///
/// The handler's return value, if non-null, is used as a response, unencoded.
///
/// This is intended for testing. Messages intercepted in this manner are not
/// sent to platform plugins.
@Deprecated
(
'Use defaultBinaryMessenger.setMockMessageHandler instead. '
'This feature was deprecated after v1.6.5.'
)
static
void
setMockMessageHandler
(
String
channel
,
Future
<
ByteData
?>
Function
(
ByteData
?
message
)
handler
)
{
_binaryMessenger
.
setMockMessageHandler
(
channel
,
handler
);
}
}
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