diff --git a/.github/workflows/checkout.yml b/.github/workflows/checkout.yml new file mode 100644 index 0000000..4948b3c --- /dev/null +++ b/.github/workflows/checkout.yml @@ -0,0 +1,91 @@ +name: Checkout + +on: + workflow_dispatch: + push: + branches: + - "master" + - "develop" + - "feature/**" + - "bugfix/**" + - "hotfix/**" + - "support/**" + paths: + - "lib/**.dart" + - "test/**.dart" + - "example/**.dart" + - "pubspec.yaml" + pull_request: + branches: + - "master" + - "develop" + - "feature/**" + - "bugfix/**" + - "hotfix/**" + - "support/**" + paths: + - "lib/**.dart" + - "test/**.dart" + - "example/**.dart" + - "pubspec.yaml" + +jobs: + checkout: + name: "Checkout" + runs-on: ubuntu-latest + container: + image: dart:beta + defaults: + run: + working-directory: ./ + timeout-minutes: 10 + steps: + - name: ๐Ÿš‚ Get latest code + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: ๐Ÿšƒ Cache pub modules + uses: actions/cache@v2 + env: + cache-name: cache-ws-package + with: + path: | + $PWD/.pub_cache/ + key: ${{ runner.os }}-ws-${{ env.cache-name }}-${{ hashFiles('**/pubspec.yaml') }} + + - name: ๐Ÿ—„๏ธ Export pub cache directory + run: export PUB_CACHE=$PWD/.pub_cache/ + + - name: ๐Ÿ‘ท Install Dependencies + timeout-minutes: 1 + run: | + dart pub get + + - name: ๐Ÿ”Ž Check format + timeout-minutes: 1 + run: dart format --set-exit-if-changed -l 80 -o none . + + - name: ๐Ÿ“ˆ Check analyzer + timeout-minutes: 1 + run: dart analyze --fatal-infos --fatal-warnings lib + + #- name: Check with pana + # run: dart pub global activate pana && pana --json --no-warning --line-length 80 + - name: ๐Ÿงช Run tests + run: | + dart test --coverage=coverage \ + && dart run coverage:format_coverage --lcov --in=coverage \ + --out=coverage/lcov.info --report-on=lib + + - name: ๐Ÿ“ฅ Upload coverage to Codecov + uses: codecov/codecov-action@v2.1.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + - name: ๐Ÿงฎ Check Code Coverage + uses: VeryGoodOpenSource/very_good_coverage@v1.2.1 + with: + path: coverage/lcov.info + min_coverage: 90 + #exclude: '**.g.dart **.freezed.dart' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index d7657f5..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: platform_info - -on: - workflow_dispatch: - push: - branches: - - 'master' - - 'dev' - - 'feature/**' - - 'bugfix/**' - - 'hotfix/**' - - 'support/**' - paths: - - 'lib/**.dart' - pull_request: - branches: - - 'master' - - 'dev' - - 'feature/**' - - 'bugfix/**' - - 'hotfix/**' - - 'support/**' - paths: - - 'lib/**.dart' - -jobs: - check: - runs-on: ubuntu-latest - container: - image: google/dart:latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - name: Install Dependencies - run: dart pub get - - name: Check format - run: dart format --set-exit-if-changed -l 80 -o none . - - name: Check analyzer - run: dart analyze --fatal-infos --fatal-warnings . - #- name: Check with pana - # run: dart pub global activate pana && pana --json --no-warning --line-length 80 - - name: Run tests - run: | - dart test --coverage=coverage \ - && dart run coverage:format_coverage --lcov --in=coverage \ - --out=coverage/lcov.info --report-on=lib - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2.1.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - name: Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v1.2.1 - with: - path: coverage/lcov.info - min_coverage: 90 - #exclude: '**.g.dart **.freezed.dart' diff --git a/.gitignore b/.gitignore index 3088584..22a5c94 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,8 @@ doc pubspec.lock coverage* +# Test +.coverage/ +/test/**/*.json /test/.test_coverage.dart +log.pana.json \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..6869a8c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,57 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + // https://pub.dev/packages/test + // dart test test/ws_test.dart --color --platform=vm + { + "name": "Test (VM)", + "request": "launch", + "type": "dart", + "program": "test/platform_info_test.dart", + "env": { + "ENVIRONMENT": "test" + }, + "console": "debugConsole", + "runTestsOnDevice": false, + "templateFor": "test", + "toolArgs": [ + "--color", + "--debug", + "--coverage=.coverage", + "--reporter=expanded", + "--platform=vm", // chrome + "--file-reporter=json:.coverage/tests.json", + "--timeout=30s", + "--concurrency=12" + ], + "args": [] + }, + // dart test test/ws_test.dart --color --platform=chrome + { + "name": "Test (Browser)", + "request": "launch", + "type": "dart", + "program": "test/platform_info_test.dart", + "env": { + "ENVIRONMENT": "test" + }, + "console": "debugConsole", + "runTestsOnDevice": false, + "templateFor": "test", + "toolArgs": [ + "--color", + "--debug", + "--coverage=.coverage", + "--reporter=expanded", + "--platform=chrome", + "--file-reporter=json:.coverage/tests.json", + "--timeout=30s", + "--concurrency=12" + ], + "args": [] + } + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 05d440a..1de1cbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,96 +1,122 @@ -## 3.2.0 - 2022-05-19 -### Fixed +## 4.0.0 - 2023-05-13 + +### Changed + +- Dart 3.0.0 ready + +## 3.2.0 - 2022-05-19 + +### Fixed + - Linux is desktop platform now -## 3.1.0 - 2021-05-29 -### Added +## 3.1.0 - 2021-05-29 + +### Added + - Extensions for enums BuildMode, HostPlatformType, OperatingSystem -## 3.0.0 - 2021-03-27 -### Changed -- Non nullable ready +## 3.0.0 - 2021-03-27 + +### Changed + +- Non nullable ready - Refactoring - - -## 3.0.0-nullsafety.2 - 2021-03-24 -### Added -- Add some badges + +## 3.0.0-nullsafety.2 - 2021-03-24 + +### Added + +- Add some badges ## 3.0.0-nullsafety.1 - 2021-02-19 -### Changed -- Non nullable ready - - -## 2.2.0 - 2020-11-20 -### Changed -- Add when feature - - -## 2.1.0 - 2020-10-18 -### Changed -- Fix `kListOSWithCupertinoDesign` constant and `isCupertino` flag - - -## 2.0.1 - 2020-09-06 -### Added -- Add getters: - + `isWeb` - Is a web-based applications - + `isIO` - Is a I/O supporting for non-web applications - - -## 2.0.0 - 2020-08-28 -### Added -- Add global getter platform -- operating system check -- Three short form to access the instance of Platform - + `Platform.instance` - + `Platform.I` - + `platform` - -### Changed -- refactoring and new lints (pedantic + effective dart) - -### Removed -- Removed toJson() method from Platform -- Remove default factory Platform() - - -## 1.1.1+3 - 2020-04-25 -### Changed -- Fix analysis options - - -## 1.1.1+2 - 2020-04-25 -### Removed -- Disable most dev dependencies - - -## 1.1.1+1 - 2020-04-23 -### Added -- Add logo image - - -## 1.1.1 - 2020-04-23 -### Added -- Cashed flags -- Add toJson() method - - -## 1.1.0 - 2020-04-23 -### Added - - Add new flags: - + isDesktop - + isMaterial - + isCupertino - - -## 1.0.1 - 2020-04-22 -### Changed -- Update badge and readme - - -## 1.0.0 - 2020-04-22 -### Added -- Initial Version of the library. - - \ No newline at end of file + +### Changed + +- Non nullable ready + +## 2.2.0 - 2020-11-20 + +### Changed + +- Add when feature + +## 2.1.0 - 2020-10-18 + +### Changed + +- Fix `kListOSWithCupertinoDesign` constant and `isCupertino` flag + +## 2.0.1 - 2020-09-06 + +### Added + +- Add getters: + - `isWeb` - Is a web-based applications + - `isIO` - Is a I/O supporting for non-web applications + +## 2.0.0 - 2020-08-28 + +### Added + +- Add global getter platform +- operating system check +- Three short form to access the instance of Platform + - `Platform.instance` + - `Platform.I` + - `platform` + +### Changed + +- refactoring and new lints (pedantic + effective dart) + +### Removed + +- Removed toJson() method from Platform +- Remove default factory Platform() + +## 1.1.1+3 - 2020-04-25 + +### Changed + +- Fix analysis options + +## 1.1.1+2 - 2020-04-25 + +### Removed + +- Disable most dev dependencies + +## 1.1.1+1 - 2020-04-23 + +### Added + +- Add logo image + +## 1.1.1 - 2020-04-23 + +### Added + +- Cashed flags +- Add toJson() method + +## 1.1.0 - 2020-04-23 + +### Added + +- Add new flags: + - isDesktop + - isMaterial + - isCupertino + +## 1.0.1 - 2020-04-22 + +### Changed + +- Update badge and readme + +## 1.0.0 - 2020-04-22 + +### Added + +- Initial Version of the library. diff --git a/LICENSE b/LICENSE index 6eb9d53..993c1e0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,20 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 +MIT License +Copyright (c) 2023 Matiunin Mikhail -Copyright (C) 2020 Plague Fox +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -Everyone is permitted to copy and distribute verbatim or modified -copies of this license document, and changing it is allowed as long -as the name is changed. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile index 1631310..f9c3dd6 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,8 @@ deploy: coverage: get @dart test --concurrency=6 --platform vm --coverage=coverage test/ @dart run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib - #@mv coverage/lcov.info coverage/lcov.base.info - #@lcov -r coverage/lcov.base.info -o coverage/lcov.base.info "lib/**.freezed.dart" "lib/**.g.dart" - #@mv coverage/lcov.base.info coverage/lcov.info +# @mv coverage/lcov.info coverage/lcov.base.info +# @lcov -r coverage/lcov.base.info -o coverage/lcov.base.info "lib/**.freezed.dart" "lib/**.g.dart" +# @mv coverage/lcov.base.info coverage/lcov.info @lcov --list coverage/lcov.info @genhtml -o coverage coverage/lcov.info diff --git a/analysis_options.yaml b/analysis_options.yaml index 917f1e4..1fd2fcf 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,7 +2,7 @@ # https://dart.dev/guides/language/analysis-options/ # https://dart-lang.github.io/linter/lints/ -#include: package:pedantic/analysis_options.1.9.0.yaml +include: package:lints/recommended.yaml analyzer: exclude: @@ -20,9 +20,11 @@ analyzer: # Coverage - 'test/.test_coverage.dart' - strong-mode: - implicit-casts: false - implicit-dynamic: false + # Enable the following options to enable strong mode. + language: + strict-casts: true + strict-raw-types: true + strict-inference: true #enable-experiment: # - non-nullable @@ -92,7 +94,6 @@ linter: close_sinks: true control_flow_in_finally: true empty_statements: true - invariant_booleans: true iterable_contains_unrelated_type: true join_return_with_assignment: true leading_newlines_in_multiline_strings: true @@ -169,7 +170,6 @@ linter: prefer_collection_literals: true prefer_conditional_assignment: true prefer_contains: true - prefer_equal_for_default_values: true prefer_final_fields: true prefer_for_elements_to_map_fromIterable: true prefer_generic_function_type_aliases: true diff --git a/lib/src/base_host_platform.dart b/lib/src/base_host_platform.dart index d706816..0ede3e3 100644 --- a/lib/src/base_host_platform.dart +++ b/lib/src/base_host_platform.dart @@ -5,11 +5,14 @@ import 'enums.dart'; /// Host platform /// contain info about host device @immutable -abstract class HostPlatform { +abstract base class HostPlatform { + /// {@nodoc} + const HostPlatform(); + /// Host platform type /// + io /// + web - HostPlatformType get type; + abstract final HostPlatformType type; /// Operation system /// + Fuchsia @@ -19,44 +22,47 @@ abstract class HostPlatform { /// + iOS /// + Android /// + Unknown - OperatingSystem get operatingSystem; + abstract final OperatingSystem operatingSystem; /// Version /// in i/o - operating system version /// in Web - user agent string - String get version; + abstract final String version; /// Locale string - String get locale; + abstract final String locale; /// The number of individual execution units of the machine /// Returns 0 if unknown or not available /// Use `.clamp(1, double.infinity)` if you need a quantity greater than 0 - int get numberOfProcessors; + abstract final int numberOfProcessors; } /// Extended host platform -abstract class ExtendedHostPlatform implements HostPlatform { +abstract base class ExtendedHostPlatform extends HostPlatform { + /// {@nodoc} + const ExtendedHostPlatform(); + /// Is web-based applications - bool get isWeb; + abstract final bool isWeb; /// Is I/O supporting for non-web applications - bool get isIO; + abstract final bool isIO; /// Operating system is known type - bool get isOperatingSystemKnown; + abstract final bool isOperatingSystemKnown; /// Is mobile device (Android, iOS) - bool get isMobile; + abstract final bool isMobile; /// Is desktop device (Windows, MacOS, Fuchsia) - bool get isDesktop; + abstract final bool isDesktop; /// Is material (Android, Fuchsia) - bool get isMaterial; + abstract final bool isMaterial; /// Is cupertino (MacOS, iOS) - bool get isCupertino; + abstract final bool isCupertino; /// Whether the operating system is a version of /// [Linux](https://en.wikipedia.org/wiki/Linux) @@ -64,31 +70,31 @@ abstract class ExtendedHostPlatform implements HostPlatform { /// This value is `false` if the operating system is a specialized /// version of Linux that identifies itself by a different name, /// for example Android (see [isAndroid]) - bool get isLinux; + abstract final bool isLinux; /// Whether the operating system is a version of /// [macOS](https://en.wikipedia.org/wiki/MacOS) - bool get isMacOS; + abstract final bool isMacOS; /// Whether the operating system is a version of /// [Microsoft Windows](https://en.wikipedia.org/wiki/Microsoft_Windows). - bool get isWindows; + abstract final bool isWindows; /// Whether the operating system is a version of /// [Android](https://en.wikipedia.org/wiki/Android_%28operating_system%29) - bool get isAndroid; + abstract final bool isAndroid; /// Whether the operating system is a version of /// [iOS](https://en.wikipedia.org/wiki/IOS) - bool get isIOS; + abstract final bool isIOS; /// Whether the operating system is a version of /// [Fuchsia](https://en.wikipedia.org/wiki/Google_Fuchsia) - bool get isFuchsia; + abstract final bool isFuchsia; /// Build mode /// + release - Release build mode /// + profile - Profile build mode /// + debug - Debug build mode - BuildMode get buildMode; + abstract final BuildMode buildMode; } diff --git a/lib/src/default_host_platform.dart b/lib/src/default_host_platform.dart index 32c2926..3ef259b 100644 --- a/lib/src/default_host_platform.dart +++ b/lib/src/default_host_platform.dart @@ -5,7 +5,7 @@ import 'enums.dart'; /// Unknown host platform with default values @immutable -class DefaultHostPlatform implements HostPlatform { +final class DefaultHostPlatform extends HostPlatform { /// Unknown host platform with default values @literal const DefaultHostPlatform(); diff --git a/lib/src/enums.dart b/lib/src/enums.dart index c21d657..7c143cf 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -4,17 +4,17 @@ /// + debug - Debug build mode enum BuildMode { /// Release build mode - release, + release(), /// Profile build mode - profile, + profile(), /// Debug build mode - debug -} + debug(); + + /// Build mode enum + const BuildMode(); -/// Build mode extension -extension BuildModeX on BuildMode { /// Is release build mode bool get isRelease => this == BuildMode.release; @@ -61,14 +61,14 @@ extension BuildModeX on BuildMode { /// + web (html, js, browser) enum HostPlatformType { /// IO (desktops, mobile, console) - io, + io(), /// Web (browser) - web, -} + web(); + + /// Host platform type + const HostPlatformType(); -/// Host platform extension -extension HostPlatformTypeX on HostPlatformType { /// Is I/O (vm, desktops, mobile, console) bool get isIO => this == HostPlatformType.io; @@ -93,29 +93,32 @@ extension HostPlatformTypeX on HostPlatformType { /// + Unknown enum OperatingSystem { /// Unknown - unknown, + unknown('Unknown'), /// Windows - windows, + windows('Windows'), /// Linux - linux, + linux('Linux'), /// MacOS - macOS, + macOS('macOS'), /// iOS - iOS, + iOS('iOS'), /// Android - android, + android('Android'), /// Fuchsia - fuchsia, -} + fuchsia('Fuchsia'); + + /// Operation system + const OperatingSystem(this.name); + + /// Operation system name + final String name; -/// Operation system extension -extension OperatingSystemX on OperatingSystem { /// Android bool get isAndroid => this == OperatingSystem.android; diff --git a/lib/src/io_host_platform.dart b/lib/src/io_host_platform.dart index d82c060..dde9df6 100644 --- a/lib/src/io_host_platform.dart +++ b/lib/src/io_host_platform.dart @@ -6,11 +6,11 @@ import 'constants.dart'; import 'enums.dart'; /// Get host platform if dart.library.io available -HostPlatform getHostPlatform() => _IOHostPlatform._(); +HostPlatform getHostPlatform() => _HostPlatform$IO._(); /// i/o based host platform -class _IOHostPlatform implements HostPlatform { - _IOHostPlatform._(); +final class _HostPlatform$IO extends HostPlatform { + _HostPlatform$IO._(); static bool get _isUnknownEnvironment => Zone.current[#platform_info_test.isUnknownEnvironment] as bool? ?? false; diff --git a/lib/src/methods.dart b/lib/src/methods.dart index 9a9c0e2..72d9548 100644 --- a/lib/src/methods.dart +++ b/lib/src/methods.dart @@ -2,7 +2,7 @@ import 'base_host_platform.dart'; import 'enums.dart'; /// Mixin with methods that extend the functionality of the platform -mixin PlatformMethods on ExtendedHostPlatform { +base mixin PlatformMethods on ExtendedHostPlatform { /// Run functions that satisfy the current state of the platform. /// You can use nested methods to compose more complex queries. /// Can return null, if [orElse] not set and any callback was not called. diff --git a/lib/src/platform.dart b/lib/src/platform.dart index be0d795..84d08b9 100644 --- a/lib/src/platform.dart +++ b/lib/src/platform.dart @@ -51,7 +51,7 @@ import 'stub_host_platform.dart' /// + Is cupertino (MacOS, iOS) /// @immutable -class Platform extends ExtendedHostPlatform with PlatformMethods { +final class Platform extends ExtendedHostPlatform with PlatformMethods { @override HostPlatformType get type => _hostPlatform.type; @@ -168,7 +168,7 @@ class Platform extends ExtendedHostPlatform with PlatformMethods { /// Fake class for test needs @immutable @visibleForTesting -class FakePlatform extends Platform { +final class FakePlatform extends Platform { /// Fake constructor for test needs FakePlatform({ BuildMode? buildMode, @@ -193,7 +193,7 @@ class FakePlatform extends Platform { /// Fake class for test needs @immutable -class _FakeHostPlatform implements HostPlatform { +final class _FakeHostPlatform extends HostPlatform { /// Fake constructor for test needs const _FakeHostPlatform({ required this.locale, diff --git a/lib/src/web_host_platform.dart b/lib/src/web_host_platform.dart index dcc991c..37b66a5 100644 --- a/lib/src/web_host_platform.dart +++ b/lib/src/web_host_platform.dart @@ -9,12 +9,12 @@ import 'enums.dart'; /// Get host platform if dart.library.html available @internal -HostPlatform getHostPlatform() => _WebHostPlatform._(); +HostPlatform getHostPlatform() => _HostPlatform$Web._(); /// Web based host platform @immutable -class _WebHostPlatform implements HostPlatform { - _WebHostPlatform._(); +final class _HostPlatform$Web extends HostPlatform { + _HostPlatform$Web._(); static bool get _isUnknownEnvironment => Zone.current[#platform_info_test.isUnknownEnvironment] as bool? ?? false; diff --git a/pubspec.yaml b/pubspec.yaml index 80181bc..13ffbc2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: platform_info description: > Contains info about current platform such as Build mode and Operating system. -version: 3.2.0 +version: 4.0.0 repository: https://github.com/PlugFox/platform_info/tree/master issue_tracker: https://github.com/PlugFox/platform_info/issues homepage: https://github.com/PlugFox/platform_info @@ -10,11 +10,12 @@ homepage: https://github.com/PlugFox/platform_info #documentation: https://pub.dev/documentation/platform_info/latest environment: - sdk: ">=2.12.0 <3.0.0" + sdk: '>=3.0.0 <4.0.0' dependencies: - meta: ^1.3.0 + meta: ^1.9.1 dev_dependencies: coverage: ^1.2.0 - test: ^1.20.2 \ No newline at end of file + lints: ^2.0.1 + test: ^1.24.2 \ No newline at end of file diff --git a/test/platform_info_test.dart b/test/platform_info_test.dart index 6e46e12..5dc2845 100644 --- a/test/platform_info_test.dart +++ b/test/platform_info_test.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:platform_info/platform_info.dart'; import 'package:platform_info/src/default_host_platform.dart'; -import 'package:platform_info/src/io_host_platform.dart' as io; import 'package:platform_info/src/stub_host_platform.dart' as stub; import 'package:test/test.dart'; @@ -86,20 +85,29 @@ void main() { }); }); - group('io platform test', () { + group('platform test', () { test('unknown environment', () { runZoned( () { - final ioPlatform = io.getHostPlatform(); - expect(ioPlatform.operatingSystem, OperatingSystem.unknown); - expect(ioPlatform.numberOfProcessors, 0); - expect(ioPlatform.locale, 'en'); - expect(ioPlatform.version, ''); - expect(ioPlatform.type, HostPlatformType.io); + final platform = DefaultHostPlatform(); + expect(platform.operatingSystem, OperatingSystem.unknown); + expect(platform.numberOfProcessors, 0); + expect(platform.locale, 'en'); + expect(platform.version, ''); + expect( + platform.type, + anyOf( + HostPlatformType.io, + HostPlatformType.web, + )); }, zoneValues: {#platform_info_test.isUnknownEnvironment: true}, ); }); + }, onPlatform: { + 'android': Timeout.factor(2), + 'ios': Timeout.factor(2), + /* 'browser': const Skip('Not supported on Browser'), */ }); group('PlatformMethods', () { @@ -108,12 +116,13 @@ void main() { test('Chaining', () { expect( - platform.when( - io: () => platform.when( + platform.when( + io: () => platform.when( material: returnTrue, cupertino: returnTrue, orElse: returnTrue, ), + web: returnTrue, orElse: returnFalse, ), isTrue);