Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
include: package:pedantic/analysis_options.1.9.0.yaml
include: package:lints/recommended.yaml

analyzer:
errors:
annotate_overrides: ignore
prefer_single_quotes: ignore
use_function_type_syntax_for_parameters: ignore
strong-mode:
implicit-casts: false
6 changes: 4 additions & 2 deletions lib/override.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class OperatingSystem {
/// from known platform specific libraries,
/// but can be overridden using functionality from the
/// `osid_override.dart` library.
static OperatingSystem get current => Zone.current[#_os] ?? platformOS;
static OperatingSystem get current =>
Zone.current[#_os] as OperatingSystem? ?? platformOS;

/// A string representing the operating system or platform.
final String id;
Expand Down Expand Up @@ -94,6 +95,7 @@ extension OperatingSystemGetters on OperatingSystem {
///
/// This override affects the `operatingSystem` and `version`
/// exported by `package:osid/osid.dart`.
R overrideOperatingSystem<R>(OperatingSystem operatingSystem, R body()) {
R overrideOperatingSystem<R>(
OperatingSystem operatingSystem, R Function() body) {
return runZoned(body, zoneValues: {#_os: operatingSystem});
}
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: Platform independent OS detection.
homepage: https://github.com/dart-lang/os_detect
environment:
sdk: '>=2.12.0 <3.0.0'

dev_dependencies:
pedantic: ^1.11.0
lints: ^1.0.0
test: ^1.16.8