Skip to content

Instantly share code, notes, and snippets.

@rodydavis
Created June 7, 2020 21:20
Show Gist options
  • Save rodydavis/16d503061d6cdae4eedeef1b519fbbcd to your computer and use it in GitHub Desktop.
Save rodydavis/16d503061d6cdae4eedeef1b519fbbcd to your computer and use it in GitHub Desktop.
Flutter Device Utils
import 'package:flutter/foundation.dart';
import 'dart:io';
bool get isWeb => kIsWeb;
bool get isMobile => !isWeb && (Platform.isIOS || Platform.isAndroid);
bool get isDesktop =>
!isWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux);
bool get isApple => !isWeb && (Platform.isIOS || Platform.isMacOS);
bool get isGoogle => !isWeb && (Platform.isAndroid || Platform.isFuchsia);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment