decodeScrollBehavior static method

ScrollBehavior? decodeScrollBehavior(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to an ScrollBehavior. This expects the given value to follow the structure below:

{
  "androidOverscrollIndicator": <AndroidOverscrollIndicator>
}

See also:

Implementation

static ScrollBehavior? decodeScrollBehavior(
  dynamic value, {
  bool validate = true,
}) {
  ScrollBehavior? result;

  if (value is ScrollBehavior) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/scroll_behavior',
      value: value,
      validate: validate,
    ));
    result = ScrollBehavior(
      androidOverscrollIndicator: decodeAndroidOverscrollIndicator(
        value['androidOverscrollIndicator'],
      ),
    );
  }

  return result;
}