step method

FontWeight step(
  1. int step
)

Steps font weight thicker (positive) or lighter (negative) by step clamped within FontWeight.w100 to FontWeight.w900.

Example:

  • FontWeight.w100.step(1) -> FontWeight.w200
  • FontWeight.w300.step(1) -> FontWeight.w400
  • FontWeight.w400.step(-1) -> FontWeight.w300

Implementation

FontWeight step(int step) {
  final newValue = (value + step * 100).clamp(100, 900);
  return FontWeight.values[(newValue ~/ 100) - 1];
}