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,4 +1,8 @@
/// The Linux implementation of `connectivity_plus`.
library connectivity_plus_linux;

export 'src/connectivity.dart';
// connectivity_plus_linux depends on dbus which uses FFI internally; export
// a stub for platforms that don't support FFI (e.g., web) to avoid having
// transitive dependencies break web compilation.
export 'src/connectivity_stub.dart'
if (dart.library.ffi) 'src/connectivity_real.dart';
16 changes: 16 additions & 0 deletions packages/connectivity_plus_linux/lib/src/connectivity_stub.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:connectivity_plus_platform_interface/connectivity_plus_platform_interface.dart';

/// A stub implementation to satisfy compilation of multi-platform packages that
/// depend on connectivity_plus_linux. This should never actually be created.
///
/// Notably, because connectivity_plus needs to manually register
/// connectivity_plus_linux, anything with a transitive dependency on
/// connectivity_plus will also depend on connectivity_plus_linux, not just at
/// the pubspec level but the code level.
class ConnectivityLinux extends ConnectivityPlatform {
/// Errors on attempted instantiation of the stub. It exists only to satisfy
/// compile-time dependencies, and should never actually be created.
ConnectivityLinux() {
assert(false);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:connectivity_plus_linux/src/connectivity.dart';
import 'package:connectivity_plus_linux/src/connectivity_real.dart';
import 'package:connectivity_plus_linux/src/network_manager.dart';
import 'package:connectivity_plus_platform_interface/connectivity_plus_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down