PackConfig.fromBuffer constructor

PackConfig.fromBuffer(
  1. List<int> data
)

Implementation

factory PackConfig.fromBuffer(List<int> data) {
  Map<String, dynamic> decode =
      LayoutSerializable.decode(bytes: data, layout: _Utils.layout(null));
  if (decode["cleanUpAction"] == 0) {
    decode = LayoutSerializable.decode(bytes: data, layout: _Utils.layout(0));
  }
  return PackConfig(
      accountType: NFTPacksAccountType.fromValue(decode["accountType"]),
      weight:
          (decode["weight"] as List).map((e) => List<int>.from(e)).toList(),
      actionToDo: CleanUpAction.fromJson(decode));
}