unfocusDisposition method

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

Retrieves an UnfocusDisposition 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 UnfocusDisposition, it is returned as is. If the value is a String or int, it is converted using the lookup tables. Otherwise, it returns defaultValue.

  • key: The key to look up in the JSON map. Defaults to 'unfocusDisposition'.
  • defaultValue: The value to return if the key is not found or cannot be resolved. Defaults to UnfocusDisposition.scope.
  • target: An optional target object to search for the property.
  • warmUp: Whether to perform a warm-up lookup only (does not cache).

Returns:

Implementation

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

  if (value is UnfocusDisposition) return value;

  if (value == null) return defaultValue;

  switch (value) {
    case String():
      if (envAttributeWarmUpEnabled) {
        if (warmUp) {
          return _unfocusDispositionStringLookupTable[value]!;
        } else {
          return _json[key] = _unfocusDispositionStringLookupTable[value]!;
        }
      } else {
        return _json[key] = _unfocusDispositionStringLookupTable[value]!;
      }
    case int():
      if (envAttributeWarmUpEnabled) {
        if (warmUp) {
          return _unfocusDispositionIntLookupTable[value]!;
        } else {
          return _json[key] = _unfocusDispositionIntLookupTable[value]!;
        }
      } else {
        return _json[key] = _unfocusDispositionIntLookupTable[value]!;
      }
    default:
      return defaultValue;
  }
}