bcsString static method

Layout<String> bcsString({
  1. String? property,
})

Serializes and deserializes UTF-8 encoded strings.

Internally uses bcsBytes to handle the byte representation of the string.

  • decoder: Converts bytes back to a UTF-8 string.
  • encoder: Converts a string to UTF-8 bytes. property is optional for mapping the data.

Implementation

static Layout<String> bcsString({String? property}) {
  return CustomLayout<List<int>, String>(
      layout: bcsBytes(),
      decoder: (bytes) {
        return StringUtils.decode(bytes);
      },
      encoder: (src) {
        return StringUtils.encode(src);
      },
      property: property);
}