fromJson method
Implementation
@override
ScrollPhysics? fromJson(Map<String, dynamic>? json) {
if (json == null) return null;
var type = json['type'];
switch (type) {
case 'always':
return AlwaysScrollableScrollPhysics(
parent: const NullableScrollPhysicsConverter().fromJson(
json['parent'],
),
);
case 'bouncing':
return BouncingScrollPhysics(
parent: const NullableScrollPhysicsConverter().fromJson(
json['parent'],
),
);
case 'clamping':
return ClampingScrollPhysics(
parent: const NullableScrollPhysicsConverter().fromJson(
json['parent'],
),
);
case 'fixedExtent':
return FixedExtentScrollPhysics(
parent: const NullableScrollPhysicsConverter().fromJson(
json['parent'],
),
);
case 'never':
return NeverScrollableScrollPhysics(
parent: const NullableScrollPhysicsConverter().fromJson(
json['parent'],
),
);
case 'page':
return PageScrollPhysics(
parent: const NullableScrollPhysicsConverter().fromJson(
json['parent'],
),
);
case 'rangeMaintaining':
return RangeMaintainingScrollPhysics(
parent: const NullableScrollPhysicsConverter().fromJson(
json['parent'],
),
);
}
throw 'Unsuported_Json_Value';
}