isAtMost method

bool isAtMost(
  1. DeviceSize max
)

Whether the current layout width class is at most max on the ordered scale mobile < tablet < desktop (inclusive upper bound).

The general test behind isTabletOrSmaller. The two degenerate ends collapse into existing getters: isAtMost(DeviceSize.desktop) is always true, and isAtMost(DeviceSize.mobile) equals isMobile.

Compares DeviceSize declaration order via index, so it relies on the enum staying declared in ascending-width order (mobile, tablet, desktop).

Implementation

bool isAtMost(DeviceSize max) => deviceSize.index <= max.index;