charset property

String? get charset

Sets and gets charset

Implementation

String? get charset => contentType?.charset;
set charset (String? charset)

Implementation

set charset(String? charset) {
  ContentType? contentType = this.contentType;
  if (contentType == null) {
    if (charset != null && charset.isNotEmpty) {
      this.contentType = new ContentType(
          ContentType.text.primaryType, ContentType.text.subType,
          charset: charset);
    }
  } else {
    if (charset != null && charset.isNotEmpty) {
      this.contentType = new ContentType(
          contentType.primaryType, contentType.subType,
          charset: charset, parameters: contentType.parameters);
    } else {
      this.contentType = new ContentType(
          contentType.primaryType, contentType.subType,
          parameters: contentType.parameters..remove('charset'));
    }
  }
}