Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
Fix broken web builds due to FFI imports (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
creativecreatorormaybenot authored Mar 7, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 3d905a2 commit 5fde40b
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions wakelock/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.0+1

* Fixed broken web builds due to FFI imports.

## 0.5.0

* Added Windows support 🚀
7 changes: 7 additions & 0 deletions wakelock/lib/src/windows_stub.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:wakelock_platform_interface/wakelock_platform_interface.dart';

/// Stub of the Windows implementation that is required because of https://github.com/creativecreatorormaybenot/wakelock/issues/102.
///
/// This should be removed as soon as https://github.com/flutter/flutter/issues/52267#issuecomment-792302417
/// is available.
class WakelockWindows extends WakelockPlatformInterface {}
7 changes: 6 additions & 1 deletion wakelock/lib/wakelock.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:wakelock/src/windows_stub.dart'
if (dart.library.io) 'package:wakelock_windows/wakelock_windows.dart';
import 'package:wakelock_macos/wakelock_macos.dart';
import 'package:wakelock_platform_interface/wakelock_platform_interface.dart';
import 'package:wakelock_windows/wakelock_windows.dart';

/// The [WakelockPlatformInterface] that is used by [Wakelock].
///
@@ -17,6 +18,10 @@ var wakelockPlatformInstance = _defaultPlatformInstance;

/// Workaround for configuring platform instances until https://github.com/flutter/flutter/issues/52267
/// arrives on stable.
///
/// As soon as https://github.com/flutter/flutter/issues/52267#issuecomment-792302417
/// is available, this should be completely removed and both macOS & Windows
/// should use `dartPluginClass` instead.
WakelockPlatformInterface get _defaultPlatformInstance {
// We want to return early on web as the platform checks are unsupported on
// web.
2 changes: 1 addition & 1 deletion wakelock/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ name: wakelock
description: >-2
Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on
Android, iOS, macOS, Windows, and web.
version: 0.5.0
version: 0.5.0+1
homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock

environment:

0 comments on commit 5fde40b

Please sign in to comment.