b method

bool b(
  1. String key, {
  2. bool defaultValue = false,
  3. bool showLog = true,
})

获取 value 转 bool

Implementation

bool b(String key, {bool defaultValue = false, bool showLog = true}) {
  if (!containsKey(key)) {
    _log('当前map不存在 key:[$key]', showLog);
    return defaultValue;
  }
  final value = this[key];
  if (value is bool) return value;
  _log('${value.runtimeType} [$key]=$value => bool:$defaultValue', showLog);
  return defaultValue;
}