Answers for "flutter push"

1

pusher connect flutter

pusher_websocket_flutter: ^0.1.1
 
 try {
      await Pusher.init(
          "Appid",
          PusherOptions(
            auth: PusherAuth(url, headers: {
              'Content-Type': 'application/json',
              'Authorization': 'Bearer ' + token
            }),
            cluster: "ap2",
            encrypted: true,
          ),
          enableLogging: true);
    } on PlatformException catch (e) {
      print(e.message);
    }

    Pusher.connect(onConnectionStateChange: (x) async {
      print(x.currentState);
    }, onError: (x) {
      debugPrint("Error: ${x.exception}");
    });
    channel = await Pusher.subscribe(
        'private-message-1'}');
    channel.bind('newmessage', (onEvent) {
	print(onEvent.data)

    });
Posted by: Guest on May-26-2021
1

flutter not navigating to a new screen

Wrap the new screen with a Scaffold widget

//navigation page
return GestureDetector(
  onTap: () {
    Navigator.push(
    context,
    MaterialPageRoute(
    	builder: (context) => DestinationScreen()),
  );
}

// new screen page
class _DestinationScreenState extends State<DestinationScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold();
  }
}
Posted by: Guest on June-12-2020

Browse Popular Code Answers by Language