decodeBottomNavigationBarType static method

BottomNavigationBarType? decodeBottomNavigationBarType(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the value to a BottomNavigationBarType. Supported values are:

  • fixed
  • shifting

Implementation

static BottomNavigationBarType? decodeBottomNavigationBarType(
  dynamic value, {
  bool validate = true,
}) {
  BottomNavigationBarType? result;

  if (value is BottomNavigationBarType) {
    result = value;
  } else {
    _checkSupported(
      'BottomNavigationBarType',
      [
        'fixed',
        'shifting',
      ],
      value,
    );

    if (value != null) {
      assert(SchemaValidator.validate(
        schemaId: '$_baseSchemaUrl/bottom_navigation_bar_type',
        value: value,
        validate: validate,
      ));
      switch (value) {
        case 'fixed':
          result = BottomNavigationBarType.fixed;
          break;
        case 'shifting':
          result = BottomNavigationBarType.shifting;
          break;
      }
    }
  }

  return result;
}