inputBorder method

  1. @preferInline
InputBorder? inputBorder({
  1. String key = FlutterPropertyKeys.inputBorder,
  2. InputBorder? defaultValue,
  3. Object? target,
  4. bool warmUp = false,
})

Retrieves an InputBorder value from the JSON map for the given key.

Looks up the value associated with key in the JSON. If the value is already an InputBorder, it is returned as is. If the value is a Map<String, dynamic>, it attempts to parse it into an InputBorder. Otherwise, it returns defaultValue.

  • key: The key to look up in the JSON map. Defaults to 'border'.
  • defaultValue: The value to return if the key is not found or cannot be resolved. Defaults to null.

Returns:

  • An InputBorder if the value is valid or can be parsed.
  • defaultValue if the value is not a valid InputBorder or cannot be parsed.
  • null if both the value and defaultValue are null.

Implementation

@preferInline
InputBorder? inputBorder({
  String key = FlutterPropertyKeys.inputBorder,
  InputBorder? defaultValue,
  Object? target,
  bool warmUp = false,
}) {
  final value = _readProp(key, target, warmUp);

  if (value is InputBorder) return value;

  if (value == null) return defaultValue;

  switch (value) {
    case Map<String, dynamic>():
      if (envAttributeWarmUpEnabled) {
        if (warmUp) {
          return _inputBorderFromMap(value);
        } else {
          return _json[key] = _inputBorderFromMap(value);
        }
      } else {
        return _json[key] = _inputBorderFromMap(value);
      }
    default:
      return defaultValue;
  }
}