From 30053f2f416f3dc2f270c4f00b3ea16d388f6ce9 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 5 Jan 2017 14:01:27 -0800 Subject: [PATCH] Deprecate HostMessages (#7352) This class is just an alias for PlatformMessages. We'll remove it after a short deprecation period. --- examples/hello_services/lib/main.dart | 4 ++-- packages/flutter/lib/src/services/host_messages.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/hello_services/lib/main.dart b/examples/hello_services/lib/main.dart index dd356544eb..a2b98ecea8 100644 --- a/examples/hello_services/lib/main.dart +++ b/examples/hello_services/lib/main.dart @@ -49,7 +49,7 @@ class _HelloServicesState extends State { Future _getLocation() async { final Map message = {'provider': 'network'}; - final Map reply = await HostMessages.sendJSON('getLocation', message); + final Map reply = await PlatformMessages.sendJSON('getLocation', message); // 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 // non-existent appearance. @@ -65,5 +65,5 @@ class _HelloServicesState extends State { void main() { runApp(new HelloServices()); - HostMessages.addJSONMessageHandler('getRandom', handleGetRandom); + PlatformMessages.setJSONMessageHandler('getRandom', handleGetRandom); } diff --git a/packages/flutter/lib/src/services/host_messages.dart b/packages/flutter/lib/src/services/host_messages.dart index b54321cd14..50aa2bb3d9 100644 --- a/packages/flutter/lib/src/services/host_messages.dart +++ b/packages/flutter/lib/src/services/host_messages.dart @@ -6,8 +6,8 @@ import 'dart:async'; import 'platform_messages.dart'; -/// A service that can be implemented by the host application and the -/// Flutter framework to exchange application-specific messages. +/// Deprecated. Use [PlatformMessages] instead. +@deprecated class HostMessages { /// Send a message to the host application. static Future sendToHost(String channel, [String message = '']) {