toJson method

  1. @override
Map<String, Object?> toJson()

Returns a JSON representation of this.

Implementation

@override
Map<String, Object?> toJson() => {
      'runtimeType': 'TarHeader',
      'entry-type': entryType.toJson(),
      'bytes': bytes.toList(),
      'path-bytes': pathBytes.toList(),
      'path': (path == null
          ? const None().toJson()
          : Option.fromValue(path).toJson()),
      'link-name-bytes': (linkNameBytes == null
          ? const None().toJson()
          : Option.fromValue(linkNameBytes).toJson((some) => some.toList())),
      'link-name': (linkName == null
          ? const None().toJson()
          : Option.fromValue(linkName).toJson()),
      'mode': (mode == null
          ? const None().toJson()
          : Option.fromValue(mode).toJson()),
      'uid': (uid == null
          ? const None().toJson()
          : Option.fromValue(uid).toJson((some) => some.toString())),
      'gid': (gid == null
          ? const None().toJson()
          : Option.fromValue(gid).toJson((some) => some.toString())),
      'mtime': (mtime == null
          ? const None().toJson()
          : Option.fromValue(mtime).toJson((some) => some.toString())),
      'username-bytes': (usernameBytes == null
          ? const None().toJson()
          : Option.fromValue(usernameBytes).toJson((some) => some.toList())),
      'username': (username == null
          ? const None().toJson()
          : Option.fromValue(username).toJson()),
      'groupname-bytes': (groupnameBytes == null
          ? const None().toJson()
          : Option.fromValue(groupnameBytes).toJson((some) => some.toList())),
      'groupname': (groupname == null
          ? const None().toJson()
          : Option.fromValue(groupname).toJson()),
      'device-major': (deviceMajor == null
          ? const None().toJson()
          : Option.fromValue(deviceMajor).toJson()),
      'device-minor': (deviceMinor == null
          ? const None().toJson()
          : Option.fromValue(deviceMinor).toJson()),
      'cksum': (cksum == null
          ? const None().toJson()
          : Option.fromValue(cksum).toJson()),
      'format-errors': formatErrors.toList(),
    };