Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io';

import 'package:flutter/foundation.dart';

/// Specify supported features for a platform.
Expand Down Expand Up @@ -127,15 +125,15 @@ class PlatformFeatures {
factory PlatformFeatures.instance() {
return kIsWeb
? webPlatformFeatures
: Platform.isAndroid
: defaultTargetPlatform == TargetPlatform.android
? androidPlatformFeatures
: Platform.isIOS
: defaultTargetPlatform == TargetPlatform.iOS
? iosPlatformFeatures
: Platform.isMacOS
: defaultTargetPlatform == TargetPlatform.macOS
? macPlatformFeatures
: Platform.isLinux
: defaultTargetPlatform == TargetPlatform.linux
? linuxPlatformFeatures
: Platform.isWindows
: defaultTargetPlatform == TargetPlatform.windows
? windowsPlatformFeatures
: const PlatformFeatures();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io';

import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -101,7 +99,8 @@ Future<void> testStreamsTab(

// Display duration & position after completion / stop
// FIXME(Gustl22): Linux does not support duration after completion event
if (features.hasDurationEvent && (kIsWeb || !Platform.isLinux)) {
if (features.hasDurationEvent &&
(kIsWeb || defaultTargetPlatform != TargetPlatform.linux)) {
await tester.testDuration(audioSourceTestData.duration);
if (!audioSourceTestData.isLiveStream) {
await tester.testOnDuration(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io' show Platform;

import 'package:flutter/foundation.dart';

/// An Audio Context is a set of secondary, platform-specific aspects of audio
Expand All @@ -26,12 +24,13 @@ class AudioContext {
}

Map<String, dynamic> toJson() {
// we need to check web first because `Platform.isX` fails on web
// we need to check web first because `defaultTargetPlatform` is not
// available for web.
if (kIsWeb) {
return <String, dynamic>{};
} else if (Platform.isAndroid) {
} else if (defaultTargetPlatform == TargetPlatform.android) {
return android.toJson();
} else if (Platform.isIOS) {
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
return iOS.toJson();
} else {
return <String, dynamic>{};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:io' show Platform;

import 'package:audioplayers_platform_interface/src/api/audio_context.dart';
import 'package:flutter/foundation.dart';

/// This class contains flags to control several secondary, platform-specific
/// aspects of audio playback, like how this audio interact with other audios,
Expand Down Expand Up @@ -113,7 +112,7 @@ class AudioContextConfig {
}

AudioContextIOS buildIOS() {
if (Platform.isIOS) {
if (defaultTargetPlatform == TargetPlatform.iOS) {
validateIOS();
}
return AudioContextIOS(
Expand Down