isWechatInstalled method

Future<bool> isWechatInstalled()

Implementation

Future<bool> isWechatInstalled() async {
  const channel = BasicMessageChannel<dynamic>('com.wangyng.hb_flutter_util.isWechatInstalled', StandardMessageCodec());
  final reply = await channel.send({});

  if (!(reply is Map)) {
    _throwChannelException();
  }

  Map<String, dynamic> replyMap = Map<String, dynamic>.from(reply);
  if (replyMap['error'] != null) {
    final HashMap<String, dynamic> error = replyMap['error'];
    _throwException(error);
  } else {

    print("replyMap ${replyMap['result'] as bool}");
    return replyMap['result'] as bool;
  }

  return false;
}