toMapEntry method

MapEntry<String, dynamic>? toMapEntry(
  1. String splitChar,
  2. bool urlDecode
)

字符串参数转map对象

Implementation

MapEntry<String, dynamic>? toMapEntry(String splitChar, bool urlDecode) {
  if (this.isEmptyString) {
    return null;
  }
  if (splitChar.isEmptyString) {
    return MapEntry(this, null);
  }
  List<String> array = this.split(splitChar);
  String value = "";
  if (array.length > 1) {
    value = urlDecode ? Uri.decodeComponent(array[1]) : array[1];
  }
  return MapEntry(array[0], value);
}