LCOV - code coverage report
Current view: top level - core/platform_detector - platform_detector.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 8 19 42.1 %
Date: 2021-04-14 08:03:52 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:stream_feed_dart/src/core/platform_detector/platform_detector_stub.dart'
       2             :     if (dart.library.html) 'platform_detector_web.dart'
       3             :     if (dart.library.io) 'platform_detector_io.dart';
       4             : 
       5             : /// Possible platforms
       6          23 : enum PlatformType { android, ios, web, macOS, windows, linux, fuchsia }
       7             : 
       8             : /// Utility class that provides information on the current platform
       9             : class CurrentPlatform {
      10           0 :   CurrentPlatform._();
      11             : 
      12             :   /// True if the app is running on android
      13           0 :   static bool get isAndroid => type == PlatformType.android;
      14             : 
      15             :   /// True if the app is running on ios
      16           0 :   static bool get isIos => type == PlatformType.ios;
      17             : 
      18             :   /// True if the app is running on web
      19           0 :   static bool get isWeb => type == PlatformType.web;
      20             : 
      21             :   /// True if the app is running on macos
      22           0 :   static bool get isMacOS => type == PlatformType.macOS;
      23             : 
      24             :   /// True if the app is running on windows
      25           0 :   static bool get isWindows => type == PlatformType.windows;
      26             : 
      27             :   /// True if the app is running on linux
      28           0 :   static bool get isLinux => type == PlatformType.linux;
      29             : 
      30             :   /// True if the app is running on fuchsia
      31           0 :   static bool get isFuchsia => type == PlatformType.fuchsia;
      32             : 
      33             :   /// Returns a string version of the platform
      34           1 :   static String get name {
      35           1 :     switch (type) {
      36           1 :       case PlatformType.android:
      37             :         return 'android';
      38           1 :       case PlatformType.ios:
      39             :         return 'ios';
      40           1 :       case PlatformType.web:
      41             :         return 'web';
      42           1 :       case PlatformType.macOS:
      43             :         return 'macos';
      44           0 :       case PlatformType.windows:
      45             :         return 'windows';
      46           0 :       case PlatformType.linux:
      47             :         return 'linux';
      48           0 :       case PlatformType.fuchsia:
      49             :         return 'fuchsia';
      50             :       default:
      51             :         return '';
      52             :     }
      53             :   }
      54             : 
      55             :   /// Get current platform type
      56           2 :   static PlatformType get type => currentPlatform;
      57             : }

Generated by: LCOV version 1.15