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 = '']) {