Committed by
GitHub
Fix broken web builds due to FFI imports (#103)
Showing
4 changed files
with
18 additions
and
2 deletions
wakelock/lib/src/windows_stub.dart
0 → 100644
| 1 | +import 'package:wakelock_platform_interface/wakelock_platform_interface.dart'; | ||
| 2 | + | ||
| 3 | +/// Stub of the Windows implementation that is required because of https://github.com/creativecreatorormaybenot/wakelock/issues/102. | ||
| 4 | +/// | ||
| 5 | +/// This should be removed as soon as https://github.com/flutter/flutter/issues/52267#issuecomment-792302417 | ||
| 6 | +/// is available. | ||
| 7 | +class WakelockWindows extends WakelockPlatformInterface {} |
| 1 | import 'dart:io'; | 1 | import 'dart:io'; |
| 2 | 2 | ||
| 3 | import 'package:flutter/foundation.dart'; | 3 | import 'package:flutter/foundation.dart'; |
| 4 | +import 'package:wakelock/src/windows_stub.dart' | ||
| 5 | + if (dart.library.io) 'package:wakelock_windows/wakelock_windows.dart'; | ||
| 4 | import 'package:wakelock_macos/wakelock_macos.dart'; | 6 | import 'package:wakelock_macos/wakelock_macos.dart'; |
| 5 | import 'package:wakelock_platform_interface/wakelock_platform_interface.dart'; | 7 | import 'package:wakelock_platform_interface/wakelock_platform_interface.dart'; |
| 6 | -import 'package:wakelock_windows/wakelock_windows.dart'; | ||
| 7 | 8 | ||
| 8 | /// The [WakelockPlatformInterface] that is used by [Wakelock]. | 9 | /// The [WakelockPlatformInterface] that is used by [Wakelock]. |
| 9 | /// | 10 | /// |
| @@ -17,6 +18,10 @@ var wakelockPlatformInstance = _defaultPlatformInstance; | @@ -17,6 +18,10 @@ var wakelockPlatformInstance = _defaultPlatformInstance; | ||
| 17 | 18 | ||
| 18 | /// Workaround for configuring platform instances until https://github.com/flutter/flutter/issues/52267 | 19 | /// Workaround for configuring platform instances until https://github.com/flutter/flutter/issues/52267 |
| 19 | /// arrives on stable. | 20 | /// arrives on stable. |
| 21 | +/// | ||
| 22 | +/// As soon as https://github.com/flutter/flutter/issues/52267#issuecomment-792302417 | ||
| 23 | +/// is available, this should be completely removed and both macOS & Windows | ||
| 24 | +/// should use `dartPluginClass` instead. | ||
| 20 | WakelockPlatformInterface get _defaultPlatformInstance { | 25 | WakelockPlatformInterface get _defaultPlatformInstance { |
| 21 | // We want to return early on web as the platform checks are unsupported on | 26 | // We want to return early on web as the platform checks are unsupported on |
| 22 | // web. | 27 | // web. |
| @@ -2,7 +2,7 @@ name: wakelock | @@ -2,7 +2,7 @@ name: wakelock | ||
| 2 | description: >-2 | 2 | description: >-2 |
| 3 | Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on | 3 | Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on |
| 4 | Android, iOS, macOS, Windows, and web. | 4 | Android, iOS, macOS, Windows, and web. |
| 5 | -version: 0.5.0 | 5 | +version: 0.5.0+1 |
| 6 | homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock | 6 | homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock |
| 7 | 7 | ||
| 8 | environment: | 8 | environment: |
-
Please register or login to post a comment