sendSpValueToSwift method

Future<void> sendSpValueToSwift(
  1. SwiftSpGetValueAction action,
  2. SocketConnect socketConnect
)

发送sp key 的值到Swift客户端

Implementation

Future<void> sendSpValueToSwift(
    SwiftSpGetValueAction action, SocketConnect socketConnect) async {
  _log(action.toJson());
  final SharedPreferences prefs = await _prefs;
  final object = prefs.get(action.data);
  if (object == null) {
    Logger().w("not found!! ${action.data}");
  } else {
    socketConnect.sendDataByModel(
        SocketSendModel.sp(
            model: SpView.sendKeyValue(value: object),
            type: SpView.socketSpGetValuesKey),
        FlutterXSendDataType.spGetValue);
  }
}