network_analyzer_platform_interface 0.1.0 copy "network_analyzer_platform_interface: ^0.1.0" to clipboard
network_analyzer_platform_interface: ^0.1.0 copied to clipboard

A common platform interface for the network_analyzer plugin.

example/example.md

Implementing a platform for network_analyzer #

This package defines the contract between the app-facing network_analyzer plugin and its platform implementations. Host applications never use it directly.

A platform implementation extends NetworkAnalyzerPlatform — extending, rather than implementing, is what keeps interface evolution non-breaking — and registers itself as the default instance from its dartPluginClass entry point:

import 'package:network_analyzer_platform_interface/network_analyzer_platform_interface.dart';

/// A hypothetical desktop implementation.
final class NetworkAnalyzerLinux extends NetworkAnalyzerPlatform {
  /// Registers this class as the default instance of the platform.
  static void registerWith() {
    NetworkAnalyzerPlatform.instance = NetworkAnalyzerLinux();
  }

  // Override startMonitoring, stopMonitoring, currentSession and
  // monitorSignals with the platform-specific behavior. Fallible
  // operations return Result<T, Failure> and never throw.
}