isMobile static method

bool isMobile(
  1. BuildContext context
)

Check if the device is a mobile device. This method checks the width of the screen in the given BuildContext context and returns true if the width is less than or equal to 500, indicating a mobile device.

Example:

bool isMobile = MyScreenUtils.isMobile(context);

Implementation

static bool isMobile(BuildContext context) {
  return MediaQuery.sizeOf(context).width <= 500;
}