Commit 30053f2f authored by Adam Barth's avatar Adam Barth Committed by GitHub

Deprecate HostMessages (#7352)

This class is just an alias for PlatformMessages. We'll remove it after a short
deprecation period.
parent 5c360c83
...@@ -49,7 +49,7 @@ class _HelloServicesState extends State<HelloServices> { ...@@ -49,7 +49,7 @@ class _HelloServicesState extends State<HelloServices> {
Future<Null> _getLocation() async { Future<Null> _getLocation() async {
final Map<String, String> message = <String, String>{'provider': 'network'}; final Map<String, String> message = <String, String>{'provider': 'network'};
final Map<String, dynamic> reply = await HostMessages.sendJSON('getLocation', message); final Map<String, dynamic> reply = await PlatformMessages.sendJSON('getLocation', message);
// If the widget was removed from the tree while the message was in flight, // If the widget was removed from the tree while the message was in flight,
// we want to discard the reply rather than calling setState to update our // we want to discard the reply rather than calling setState to update our
// non-existent appearance. // non-existent appearance.
...@@ -65,5 +65,5 @@ class _HelloServicesState extends State<HelloServices> { ...@@ -65,5 +65,5 @@ class _HelloServicesState extends State<HelloServices> {
void main() { void main() {
runApp(new HelloServices()); runApp(new HelloServices());
HostMessages.addJSONMessageHandler('getRandom', handleGetRandom); PlatformMessages.setJSONMessageHandler('getRandom', handleGetRandom);
} }
...@@ -6,8 +6,8 @@ import 'dart:async'; ...@@ -6,8 +6,8 @@ import 'dart:async';
import 'platform_messages.dart'; import 'platform_messages.dart';
/// A service that can be implemented by the host application and the /// Deprecated. Use [PlatformMessages] instead.
/// Flutter framework to exchange application-specific messages. @deprecated
class HostMessages { class HostMessages {
/// Send a message to the host application. /// Send a message to the host application.
static Future<String> sendToHost(String channel, [String message = '']) { static Future<String> sendToHost(String channel, [String message = '']) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment