From 56efadeb7c8acd2ea3884875bdb7f6d988607d46 Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Thu, 13 Oct 2022 16:58:07 +0200 Subject: [PATCH 1/6] Unfederate network_info_plus --- .../network_info_plus/example/pubspec.yaml | 8 ---- .../lib/network_info_plus.dart | 2 + .../lib/src/network_info_plus_linux.dart} | 17 +++---- .../lib/src}/network_info_plus_macos.dart | 0 .../lib/src}/network_info_plus_web.dart | 6 +-- .../lib/src}/network_info_plus_windows.dart | 0 .../macos/Classes/NetworkInfoPlusPlugin.swift | 0 .../macos/network_info_plus.podspec | 1 + .../network_info_plus/pubspec.yaml | 17 +++---- .../test/device_info_plus_linux_test.dart | 2 +- .../windows/.gitignore | 0 .../windows/CMakeLists.txt | 0 .../network_info_plus_windows/network_info.h | 0 .../network_info_plus_windows_plugin.h | 0 .../windows/network_info.cpp | 0 .../network_info_plus_windows_plugin.cpp | 0 .../network_info_plus_linux/.gitignore | 47 ------------------- .../network_info_plus_linux/.metadata | 10 ---- .../network_info_plus_linux/CHANGELOG.md | 32 ------------- .../network_info_plus_linux/LICENSE | 27 ----------- .../network_info_plus_linux/README.md | 12 ----- .../lib/network_info_plus_linux.dart | 4 -- .../network_info_plus_linux/pubspec.yaml | 30 ------------ .../network_info_plus_macos/.gitattributes | 25 ---------- .../network_info_plus_macos/.gitignore | 47 ------------------- .../network_info_plus_macos/CHANGELOG.md | 27 ----------- .../network_info_plus_macos/LICENSE | 27 ----------- .../network_info_plus_macos/README.md | 12 ----- .../macos/network_info_plus_macos.podspec | 20 -------- .../network_info_plus_macos/pubspec.yaml | 20 -------- .../network_info_plus_web/.gitattributes | 25 ---------- .../network_info_plus_web/.gitignore | 47 ------------------- .../network_info_plus_web/.metadata | 10 ---- .../network_info_plus_web/CHANGELOG.md | 15 ------ .../network_info_plus_web/LICENSE | 26 ---------- .../network_info_plus_web/README.md | 17 ------- .../network_info_plus_web/pubspec.yaml | 23 --------- .../network_info_plus_windows/.gitignore | 7 --- .../network_info_plus_windows/.metadata | 10 ---- .../network_info_plus_windows/CHANGELOG.md | 19 -------- .../network_info_plus_windows/LICENSE | 27 ----------- .../network_info_plus_windows/README.md | 12 ----- .../network_info_plus_windows/pubspec.yaml | 24 ---------- 43 files changed, 22 insertions(+), 633 deletions(-) rename packages/network_info_plus/{network_info_plus_linux/lib/src/network_info.dart => network_info_plus/lib/src/network_info_plus_linux.dart} (88%) rename packages/network_info_plus/{network_info_plus_macos/lib => network_info_plus/lib/src}/network_info_plus_macos.dart (100%) rename packages/network_info_plus/{network_info_plus_web/lib => network_info_plus/lib/src}/network_info_plus_web.dart (88%) rename packages/network_info_plus/{network_info_plus_windows/lib => network_info_plus/lib/src}/network_info_plus_windows.dart (100%) rename packages/network_info_plus/{network_info_plus_macos => network_info_plus}/macos/Classes/NetworkInfoPlusPlugin.swift (100%) rename packages/network_info_plus/{network_info_plus_linux => network_info_plus}/test/device_info_plus_linux_test.dart (80%) rename packages/network_info_plus/{network_info_plus_windows => network_info_plus}/windows/.gitignore (100%) rename packages/network_info_plus/{network_info_plus_windows => network_info_plus}/windows/CMakeLists.txt (100%) rename packages/network_info_plus/{network_info_plus_windows => network_info_plus}/windows/include/network_info_plus_windows/network_info.h (100%) rename packages/network_info_plus/{network_info_plus_windows => network_info_plus}/windows/include/network_info_plus_windows/network_info_plus_windows_plugin.h (100%) rename packages/network_info_plus/{network_info_plus_windows => network_info_plus}/windows/network_info.cpp (100%) rename packages/network_info_plus/{network_info_plus_windows => network_info_plus}/windows/network_info_plus_windows_plugin.cpp (100%) delete mode 100644 packages/network_info_plus/network_info_plus_linux/.gitignore delete mode 100644 packages/network_info_plus/network_info_plus_linux/.metadata delete mode 100644 packages/network_info_plus/network_info_plus_linux/CHANGELOG.md delete mode 100644 packages/network_info_plus/network_info_plus_linux/LICENSE delete mode 100644 packages/network_info_plus/network_info_plus_linux/README.md delete mode 100644 packages/network_info_plus/network_info_plus_linux/lib/network_info_plus_linux.dart delete mode 100644 packages/network_info_plus/network_info_plus_linux/pubspec.yaml delete mode 100644 packages/network_info_plus/network_info_plus_macos/.gitattributes delete mode 100644 packages/network_info_plus/network_info_plus_macos/.gitignore delete mode 100644 packages/network_info_plus/network_info_plus_macos/CHANGELOG.md delete mode 100644 packages/network_info_plus/network_info_plus_macos/LICENSE delete mode 100644 packages/network_info_plus/network_info_plus_macos/README.md delete mode 100644 packages/network_info_plus/network_info_plus_macos/macos/network_info_plus_macos.podspec delete mode 100644 packages/network_info_plus/network_info_plus_macos/pubspec.yaml delete mode 100644 packages/network_info_plus/network_info_plus_web/.gitattributes delete mode 100644 packages/network_info_plus/network_info_plus_web/.gitignore delete mode 100644 packages/network_info_plus/network_info_plus_web/.metadata delete mode 100644 packages/network_info_plus/network_info_plus_web/CHANGELOG.md delete mode 100644 packages/network_info_plus/network_info_plus_web/LICENSE delete mode 100644 packages/network_info_plus/network_info_plus_web/README.md delete mode 100644 packages/network_info_plus/network_info_plus_web/pubspec.yaml delete mode 100644 packages/network_info_plus/network_info_plus_windows/.gitignore delete mode 100644 packages/network_info_plus/network_info_plus_windows/.metadata delete mode 100644 packages/network_info_plus/network_info_plus_windows/CHANGELOG.md delete mode 100644 packages/network_info_plus/network_info_plus_windows/LICENSE delete mode 100644 packages/network_info_plus/network_info_plus_windows/README.md delete mode 100644 packages/network_info_plus/network_info_plus_windows/pubspec.yaml diff --git a/packages/network_info_plus/network_info_plus/example/pubspec.yaml b/packages/network_info_plus/network_info_plus/example/pubspec.yaml index 20a46bc262..8ecdea6185 100644 --- a/packages/network_info_plus/network_info_plus/example/pubspec.yaml +++ b/packages/network_info_plus/network_info_plus/example/pubspec.yaml @@ -11,16 +11,8 @@ dependencies: path: ../ dependency_overrides: - network_info_plus_linux: - path: ../../network_info_plus_linux - network_info_plus_macos: - path: ../../network_info_plus_macos network_info_plus_platform_interface: path: ../../network_info_plus_platform_interface - network_info_plus_web: - path: ../../network_info_plus_web - network_info_plus_windows: - path: ../../network_info_plus_windows dev_dependencies: flutter_driver: diff --git a/packages/network_info_plus/network_info_plus/lib/network_info_plus.dart b/packages/network_info_plus/network_info_plus/lib/network_info_plus.dart index e819b5ca3f..00a9738df8 100644 --- a/packages/network_info_plus/network_info_plus/lib/network_info_plus.dart +++ b/packages/network_info_plus/network_info_plus/lib/network_info_plus.dart @@ -11,6 +11,8 @@ import 'package:network_info_plus_platform_interface/network_info_plus_platform_ export 'package:network_info_plus_platform_interface/network_info_plus_platform_interface.dart' show LocationAuthorizationStatus; +export 'src/network_info_plus_linux.dart'; + /// Discover network info: check WI-FI details and more. class NetworkInfo { /// Constructs a singleton instance of [NetworkInfo]. diff --git a/packages/network_info_plus/network_info_plus_linux/lib/src/network_info.dart b/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_linux.dart similarity index 88% rename from packages/network_info_plus/network_info_plus_linux/lib/src/network_info.dart rename to packages/network_info_plus/network_info_plus/lib/src/network_info_plus_linux.dart index 01169e736a..0c891df8d7 100644 --- a/packages/network_info_plus/network_info_plus_linux/lib/src/network_info.dart +++ b/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_linux.dart @@ -1,25 +1,24 @@ import 'dart:async'; import 'package:collection/collection.dart'; -import 'package:network_info_plus_platform_interface/network_info_plus_platform_interface.dart'; import 'package:meta/meta.dart'; +import 'package:network_info_plus_platform_interface/network_info_plus_platform_interface.dart'; import 'package:nm/nm.dart'; // Used internally // ignore_for_file: public_member_api_docs typedef _DeviceGetter = Future Function(NetworkManagerDevice? device); -typedef _ConnectionGetter = Future Function( - NetworkManagerActiveConnection? connection); +typedef _ConnectionGetter = Future Function(NetworkManagerActiveConnection? connection); @visibleForTesting typedef NetworkManagerClientFactory = NetworkManagerClient Function(); /// The Linux implementation of NetworkInfoPlatform. -class NetworkInfoLinux extends NetworkInfoPlatform { +class NetworkInfoPlusLinuxPlugin extends NetworkInfoPlatform { /// Register this dart class as the platform implementation for linux static void registerWith() { - NetworkInfoPlatform.instance = NetworkInfoLinux(); + NetworkInfoPlatform.instance = NetworkInfoPlusLinuxPlugin(); } /// Obtains the wifi name (SSID) of the connected network @@ -76,8 +75,7 @@ class NetworkInfoLinux extends NetworkInfoPlatform { Future _getDeviceValue(_DeviceGetter getter) { return _getConnectionValue((connection) { - final device = connection?.devices - .firstWhereOrNull((device) => device.wireless != null); + final device = connection?.devices.firstWhereOrNull((device) => device.wireless != null); return getter(device); }); } @@ -119,10 +117,7 @@ extension _IpInt on int { extension _IpString on String { int toIpInt() { final parts = split('.'); - return parts.intAtOrZero(3) << 24 | - parts.intAtOrZero(2) << 16 | - parts.intAtOrZero(1) << 8 | - parts.intAtOrZero(0); + return parts.intAtOrZero(3) << 24 | parts.intAtOrZero(2) << 16 | parts.intAtOrZero(1) << 8 | parts.intAtOrZero(0); } } diff --git a/packages/network_info_plus/network_info_plus_macos/lib/network_info_plus_macos.dart b/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_macos.dart similarity index 100% rename from packages/network_info_plus/network_info_plus_macos/lib/network_info_plus_macos.dart rename to packages/network_info_plus/network_info_plus/lib/src/network_info_plus_macos.dart diff --git a/packages/network_info_plus/network_info_plus_web/lib/network_info_plus_web.dart b/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_web.dart similarity index 88% rename from packages/network_info_plus/network_info_plus_web/lib/network_info_plus_web.dart rename to packages/network_info_plus/network_info_plus/lib/src/network_info_plus_web.dart index 803e77b103..38734c607e 100644 --- a/packages/network_info_plus/network_info_plus_web/lib/network_info_plus_web.dart +++ b/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_web.dart @@ -1,12 +1,12 @@ -import 'package:network_info_plus_platform_interface/network_info_plus_platform_interface.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart'; +import 'package:network_info_plus_platform_interface/network_info_plus_platform_interface.dart'; /// A stub implementation of the NetworkInfoPlatform interface for Web. -class NetworkInfoPlusPlugin extends NetworkInfoPlatform { +class NetworkInfoPlusWebPlugin extends NetworkInfoPlatform { /// Factory method that initializes the network info plugin platform with /// an instance of the plugin for the web. static void registerWith(Registrar registrar) { - NetworkInfoPlatform.instance = NetworkInfoPlusPlugin(); + NetworkInfoPlatform.instance = NetworkInfoPlusWebPlugin(); } /// Obtains the wifi name (SSID) of the connected network diff --git a/packages/network_info_plus/network_info_plus_windows/lib/network_info_plus_windows.dart b/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_windows.dart similarity index 100% rename from packages/network_info_plus/network_info_plus_windows/lib/network_info_plus_windows.dart rename to packages/network_info_plus/network_info_plus/lib/src/network_info_plus_windows.dart diff --git a/packages/network_info_plus/network_info_plus_macos/macos/Classes/NetworkInfoPlusPlugin.swift b/packages/network_info_plus/network_info_plus/macos/Classes/NetworkInfoPlusPlugin.swift similarity index 100% rename from packages/network_info_plus/network_info_plus_macos/macos/Classes/NetworkInfoPlusPlugin.swift rename to packages/network_info_plus/network_info_plus/macos/Classes/NetworkInfoPlusPlugin.swift diff --git a/packages/network_info_plus/network_info_plus/macos/network_info_plus.podspec b/packages/network_info_plus/network_info_plus/macos/network_info_plus.podspec index 8371009463..f77db19e03 100644 --- a/packages/network_info_plus/network_info_plus/macos/network_info_plus.podspec +++ b/packages/network_info_plus/network_info_plus/macos/network_info_plus.podspec @@ -15,6 +15,7 @@ Pod::Spec.new do |s| s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' + s.dependency 'FlutterMacOS' s.platform = :osx s.osx.deployment_target = '10.11' diff --git a/packages/network_info_plus/network_info_plus/pubspec.yaml b/packages/network_info_plus/network_info_plus/pubspec.yaml index 79ecad92d6..a150891551 100644 --- a/packages/network_info_plus/network_info_plus/pubspec.yaml +++ b/packages/network_info_plus/network_info_plus/pubspec.yaml @@ -18,23 +18,24 @@ flutter: ios: pluginClass: FLTNetworkInfoPlusPlugin linux: - default_package: network_info_plus_linux + dartPluginClass: NetworkInfoPlusLinuxPlugin macos: - default_package: network_info_plus_macos + pluginClass: NetworkInfoPlusPlugin windows: - default_package: network_info_plus_windows + pluginClass: NetworkInfoPlusWindowsPlugin web: - default_package: network_info_plus_web + pluginClass: NetworkInfoPlusWebPlugin + fileName: src/network_info_plus_web.dart dependencies: + collection: ^1.15.0 + nm: ^0.5.0 flutter: sdk: flutter + flutter_web_plugins: + sdk: flutter meta: ^1.8.0 network_info_plus_platform_interface: ^1.1.2 - network_info_plus_linux: ^1.1.2 - network_info_plus_macos: ^1.3.0 - network_info_plus_windows: ^1.0.2 - network_info_plus_web: ^1.0.1 dev_dependencies: flutter_test: diff --git a/packages/network_info_plus/network_info_plus_linux/test/device_info_plus_linux_test.dart b/packages/network_info_plus/network_info_plus/test/device_info_plus_linux_test.dart similarity index 80% rename from packages/network_info_plus/network_info_plus_linux/test/device_info_plus_linux_test.dart rename to packages/network_info_plus/network_info_plus/test/device_info_plus_linux_test.dart index 69c5c0121c..ed573e5d97 100644 --- a/packages/network_info_plus/network_info_plus_linux/test/device_info_plus_linux_test.dart +++ b/packages/network_info_plus/network_info_plus/test/device_info_plus_linux_test.dart @@ -1,5 +1,5 @@ import 'package:flutter_test/flutter_test.dart'; -import 'package:network_info_plus_linux/src/network_info.dart'; +import 'package:network_info_plus_linux/src/network_info_plus_linux.dart'; import 'package:network_info_plus_platform_interface/network_info_plus_platform_interface.dart'; void main() { diff --git a/packages/network_info_plus/network_info_plus_windows/windows/.gitignore b/packages/network_info_plus/network_info_plus/windows/.gitignore similarity index 100% rename from packages/network_info_plus/network_info_plus_windows/windows/.gitignore rename to packages/network_info_plus/network_info_plus/windows/.gitignore diff --git a/packages/network_info_plus/network_info_plus_windows/windows/CMakeLists.txt b/packages/network_info_plus/network_info_plus/windows/CMakeLists.txt similarity index 100% rename from packages/network_info_plus/network_info_plus_windows/windows/CMakeLists.txt rename to packages/network_info_plus/network_info_plus/windows/CMakeLists.txt diff --git a/packages/network_info_plus/network_info_plus_windows/windows/include/network_info_plus_windows/network_info.h b/packages/network_info_plus/network_info_plus/windows/include/network_info_plus_windows/network_info.h similarity index 100% rename from packages/network_info_plus/network_info_plus_windows/windows/include/network_info_plus_windows/network_info.h rename to packages/network_info_plus/network_info_plus/windows/include/network_info_plus_windows/network_info.h diff --git a/packages/network_info_plus/network_info_plus_windows/windows/include/network_info_plus_windows/network_info_plus_windows_plugin.h b/packages/network_info_plus/network_info_plus/windows/include/network_info_plus_windows/network_info_plus_windows_plugin.h similarity index 100% rename from packages/network_info_plus/network_info_plus_windows/windows/include/network_info_plus_windows/network_info_plus_windows_plugin.h rename to packages/network_info_plus/network_info_plus/windows/include/network_info_plus_windows/network_info_plus_windows_plugin.h diff --git a/packages/network_info_plus/network_info_plus_windows/windows/network_info.cpp b/packages/network_info_plus/network_info_plus/windows/network_info.cpp similarity index 100% rename from packages/network_info_plus/network_info_plus_windows/windows/network_info.cpp rename to packages/network_info_plus/network_info_plus/windows/network_info.cpp diff --git a/packages/network_info_plus/network_info_plus_windows/windows/network_info_plus_windows_plugin.cpp b/packages/network_info_plus/network_info_plus/windows/network_info_plus_windows_plugin.cpp similarity index 100% rename from packages/network_info_plus/network_info_plus_windows/windows/network_info_plus_windows_plugin.cpp rename to packages/network_info_plus/network_info_plus/windows/network_info_plus_windows_plugin.cpp diff --git a/packages/network_info_plus/network_info_plus_linux/.gitignore b/packages/network_info_plus/network_info_plus_linux/.gitignore deleted file mode 100644 index 88ce490e47..0000000000 --- a/packages/network_info_plus/network_info_plus_linux/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -.DS_Store -.atom/ -.idea/ -.vscode/ - -.packages -.pub/ -.dart_tool/ -pubspec.lock -flutter_export_environment.sh - -examples/all_plugins/pubspec.yaml - -Podfile -Podfile.lock -Pods/ -.symlinks/ -**/Flutter/App.framework/ -**/Flutter/ephemeral/ -**/Flutter/Flutter.framework/ -**/Flutter/Generated.xcconfig -**/Flutter/flutter_assets/ - -ServiceDefinitions.json -xcuserdata/ -**/DerivedData/ - -local.properties -keystore.properties -.gradle/ -gradlew -gradlew.bat -gradle-wrapper.jar -.flutter-plugins-dependencies -*.iml - -generated_plugin_registrant.dart -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m -GeneratedPluginRegistrant.java -GeneratedPluginRegistrant.swift -build/ -.flutter-plugins - -.project -.classpath -.settings diff --git a/packages/network_info_plus/network_info_plus_linux/.metadata b/packages/network_info_plus/network_info_plus_linux/.metadata deleted file mode 100644 index 6b9d686e29..0000000000 --- a/packages/network_info_plus/network_info_plus_linux/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 34541c30735bc1086335e13d69a7e0acdc0538c5 - channel: master - -project_type: package diff --git a/packages/network_info_plus/network_info_plus_linux/CHANGELOG.md b/packages/network_info_plus/network_info_plus_linux/CHANGELOG.md deleted file mode 100644 index d564820b52..0000000000 --- a/packages/network_info_plus/network_info_plus_linux/CHANGELOG.md +++ /dev/null @@ -1,32 +0,0 @@ -## 1.1.2 - -- Bump nm dependency to 0.5.0 - -## 1.1.1 - -- Update Flutter dependencies - -## 1.1.0 - -- Port to nm.dart -- Add IPv6, gateway IP, subnet mask, broadcast - -## 1.0.2 - -- Upgrade D-Bus package dependency - -## 1.0.1 - -- Improve documentation - -## 1.0.0 - -- Migrate to null-safety. - -## 0.1.1 - -- Address pub score. - -## 0.1.0 - -- Initial release for Linux. diff --git a/packages/network_info_plus/network_info_plus_linux/LICENSE b/packages/network_info_plus/network_info_plus_linux/LICENSE deleted file mode 100644 index 0c91662b3f..0000000000 --- a/packages/network_info_plus/network_info_plus_linux/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/network_info_plus/network_info_plus_linux/README.md b/packages/network_info_plus/network_info_plus_linux/README.md deleted file mode 100644 index 2ae3411189..0000000000 --- a/packages/network_info_plus/network_info_plus_linux/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Network Info Plus Linux - -[![Flutter Community: network_info_plus_linux](https://fluttercommunity.dev/_github/header/network_info_plus_linux)](https://github.com/fluttercommunity/community) - -[![pub package](https://img.shields.io/pub/v/network_info_plus_linux.svg)](https://pub.dev/packages/network_info_plus_linux) - -The Linux implementation of [`network_info_plus`](https://pub.dev/packages/network_info_plus). - -## Usage - -This package is already included as part of the `network_info_plus` package dependency, and will -be included when using `network_info_plus` as normal. diff --git a/packages/network_info_plus/network_info_plus_linux/lib/network_info_plus_linux.dart b/packages/network_info_plus/network_info_plus_linux/lib/network_info_plus_linux.dart deleted file mode 100644 index dde988c1bf..0000000000 --- a/packages/network_info_plus/network_info_plus_linux/lib/network_info_plus_linux.dart +++ /dev/null @@ -1,4 +0,0 @@ -/// The Linux implementation of `network_info_plus`. -library network_info_plus_linux; - -export 'src/network_info.dart'; diff --git a/packages/network_info_plus/network_info_plus_linux/pubspec.yaml b/packages/network_info_plus/network_info_plus_linux/pubspec.yaml deleted file mode 100644 index abfc30d384..0000000000 --- a/packages/network_info_plus/network_info_plus_linux/pubspec.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: network_info_plus_linux -description: Linux implementation of the network_info_plus plugin -homepage: https://plus.fluttercommunity.dev/ -repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/ -version: 1.1.2 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" - -dependencies: - collection: ^1.15.0 - flutter: - sdk: flutter - meta: ^1.7.0 - network_info_plus_platform_interface: ^1.1.0 - nm: ^0.5.0 - -dev_dependencies: - flutter_test: - sdk: flutter - flutter_lints: ">=1.0.4 <3.0.0" - -flutter: - plugin: - implements: network_info_plus - platforms: - linux: - dartPluginClass: NetworkInfoLinux - pluginClass: none diff --git a/packages/network_info_plus/network_info_plus_macos/.gitattributes b/packages/network_info_plus/network_info_plus_macos/.gitattributes deleted file mode 100644 index 31fda4bf1c..0000000000 --- a/packages/network_info_plus/network_info_plus_macos/.gitattributes +++ /dev/null @@ -1,25 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Always perform LF normalization on these files -*.dart text -*.gradle text -*.html text -*.java text -*.json text -*.md text -*.py text -*.sh text -*.txt text -*.xml text -*.yaml text - -# Make sure that these Windows files always have CRLF line endings in checkout -*.bat text eol=crlf -*.ps1 text eol=crlf - -# Never perform LF normalization on these files -*.ico binary -*.jar binary -*.png binary -*.zip binary diff --git a/packages/network_info_plus/network_info_plus_macos/.gitignore b/packages/network_info_plus/network_info_plus_macos/.gitignore deleted file mode 100644 index 88ce490e47..0000000000 --- a/packages/network_info_plus/network_info_plus_macos/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -.DS_Store -.atom/ -.idea/ -.vscode/ - -.packages -.pub/ -.dart_tool/ -pubspec.lock -flutter_export_environment.sh - -examples/all_plugins/pubspec.yaml - -Podfile -Podfile.lock -Pods/ -.symlinks/ -**/Flutter/App.framework/ -**/Flutter/ephemeral/ -**/Flutter/Flutter.framework/ -**/Flutter/Generated.xcconfig -**/Flutter/flutter_assets/ - -ServiceDefinitions.json -xcuserdata/ -**/DerivedData/ - -local.properties -keystore.properties -.gradle/ -gradlew -gradlew.bat -gradle-wrapper.jar -.flutter-plugins-dependencies -*.iml - -generated_plugin_registrant.dart -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m -GeneratedPluginRegistrant.java -GeneratedPluginRegistrant.swift -build/ -.flutter-plugins - -.project -.classpath -.settings diff --git a/packages/network_info_plus/network_info_plus_macos/CHANGELOG.md b/packages/network_info_plus/network_info_plus_macos/CHANGELOG.md deleted file mode 100644 index ef0ae95d67..0000000000 --- a/packages/network_info_plus/network_info_plus_macos/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -## 1.3.0 - -- Add submask, broadcast, gateway info - -## 1.2.0 - -- Remove `Reachability` dependency - -## 1.1.0 - -- Add IP v6 support - -## 1.0.1 - -- Improve documentation - -## 1.0.0 - -- Migrate to null-safety. - -## 0.1.1 - -- Address pub score. - -## 0.1.0 - -- Initial release. diff --git a/packages/network_info_plus/network_info_plus_macos/LICENSE b/packages/network_info_plus/network_info_plus_macos/LICENSE deleted file mode 100644 index 0c382ce171..0000000000 --- a/packages/network_info_plus/network_info_plus_macos/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/network_info_plus/network_info_plus_macos/README.md b/packages/network_info_plus/network_info_plus_macos/README.md deleted file mode 100644 index 1030ea5c19..0000000000 --- a/packages/network_info_plus/network_info_plus_macos/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Network Info Plus macOS - -[![Flutter Community: network_info_plus_macos](https://fluttercommunity.dev/_github/header/network_info_plus_macos)](https://github.com/fluttercommunity/community) - -[![pub package](https://img.shields.io/pub/v/network_info_plus_macos.svg)](https://pub.dev/packages/network_info_plus_macos) - -The macOS implementation of [`network_info_plus`](https://pub.dev/packages/network_info_plus). - -## Usage - -This package is already included as part of the `network_info_plus` package dependency, and will -be included when using `network_info_plus` as normal. diff --git a/packages/network_info_plus/network_info_plus_macos/macos/network_info_plus_macos.podspec b/packages/network_info_plus/network_info_plus_macos/macos/network_info_plus_macos.podspec deleted file mode 100644 index 199e99844a..0000000000 --- a/packages/network_info_plus/network_info_plus_macos/macos/network_info_plus_macos.podspec +++ /dev/null @@ -1,20 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html -# -Pod::Spec.new do |s| - s.name = 'network_info_plus_macos' - s.version = '0.0.1' - s.summary = 'Flutter plugin for checking network info' - s.description = <<-DESC - Desktop implementation of the network info plugin - DESC - s.homepage = 'https://github.com/fluttercommunity/plus_plugins' - s.license = { :type => 'BSD', :file => '../LICENSE' } - s.author = { 'Flutter Team' => 'flutter-dev@googlegroups.com' } - s.source = { :http => 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/network_info_plus_macos' } - s.source_files = 'Classes/**/*' - s.dependency 'FlutterMacOS' - - s.platform = :osx - s.osx.deployment_target = '10.11' -end \ No newline at end of file diff --git a/packages/network_info_plus/network_info_plus_macos/pubspec.yaml b/packages/network_info_plus/network_info_plus_macos/pubspec.yaml deleted file mode 100644 index ed375d5dc3..0000000000 --- a/packages/network_info_plus/network_info_plus_macos/pubspec.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: network_info_plus_macos -description: macOS implementation of the network_info_plus plugin. -version: 1.3.0 -homepage: https://plus.fluttercommunity.dev/ -repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/ - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" - -flutter: - plugin: - platforms: - macos: - pluginClass: NetworkInfoPlusPlugin - -dependencies: - network_info_plus_platform_interface: ^1.1.2 - flutter: - sdk: flutter diff --git a/packages/network_info_plus/network_info_plus_web/.gitattributes b/packages/network_info_plus/network_info_plus_web/.gitattributes deleted file mode 100644 index 31fda4bf1c..0000000000 --- a/packages/network_info_plus/network_info_plus_web/.gitattributes +++ /dev/null @@ -1,25 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Always perform LF normalization on these files -*.dart text -*.gradle text -*.html text -*.java text -*.json text -*.md text -*.py text -*.sh text -*.txt text -*.xml text -*.yaml text - -# Make sure that these Windows files always have CRLF line endings in checkout -*.bat text eol=crlf -*.ps1 text eol=crlf - -# Never perform LF normalization on these files -*.ico binary -*.jar binary -*.png binary -*.zip binary diff --git a/packages/network_info_plus/network_info_plus_web/.gitignore b/packages/network_info_plus/network_info_plus_web/.gitignore deleted file mode 100644 index 88ce490e47..0000000000 --- a/packages/network_info_plus/network_info_plus_web/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -.DS_Store -.atom/ -.idea/ -.vscode/ - -.packages -.pub/ -.dart_tool/ -pubspec.lock -flutter_export_environment.sh - -examples/all_plugins/pubspec.yaml - -Podfile -Podfile.lock -Pods/ -.symlinks/ -**/Flutter/App.framework/ -**/Flutter/ephemeral/ -**/Flutter/Flutter.framework/ -**/Flutter/Generated.xcconfig -**/Flutter/flutter_assets/ - -ServiceDefinitions.json -xcuserdata/ -**/DerivedData/ - -local.properties -keystore.properties -.gradle/ -gradlew -gradlew.bat -gradle-wrapper.jar -.flutter-plugins-dependencies -*.iml - -generated_plugin_registrant.dart -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m -GeneratedPluginRegistrant.java -GeneratedPluginRegistrant.swift -build/ -.flutter-plugins - -.project -.classpath -.settings diff --git a/packages/network_info_plus/network_info_plus_web/.metadata b/packages/network_info_plus/network_info_plus_web/.metadata deleted file mode 100644 index 23eb55ba6d..0000000000 --- a/packages/network_info_plus/network_info_plus_web/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 52ee8a6c6565cd421dfa32042941eb40691f4746 - channel: master - -project_type: plugin diff --git a/packages/network_info_plus/network_info_plus_web/CHANGELOG.md b/packages/network_info_plus/network_info_plus_web/CHANGELOG.md deleted file mode 100644 index 419c694687..0000000000 --- a/packages/network_info_plus/network_info_plus_web/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -## 1.0.1 - -- Improve documentation - -## 1.0.0 - -- Migrate to null-safety. - -## 0.1.1 - -- Address pub score. - -## 0.1.0 - -- Added a stub implementation that throws unsupported exceptions. diff --git a/packages/network_info_plus/network_info_plus_web/LICENSE b/packages/network_info_plus/network_info_plus_web/LICENSE deleted file mode 100644 index 4da9688730..0000000000 --- a/packages/network_info_plus/network_info_plus_web/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright 2016, the Flutter project authors. All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of Google Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/network_info_plus/network_info_plus_web/README.md b/packages/network_info_plus/network_info_plus_web/README.md deleted file mode 100644 index 6e2c9db071..0000000000 --- a/packages/network_info_plus/network_info_plus_web/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Network Info Plus Web - -[![Flutter Community: network_info_plus_web](https://fluttercommunity.dev/_github/header/network_info_plus_web)](https://github.com/fluttercommunity/community) - -[![pub package](https://img.shields.io/pub/v/network_info_plus_web.svg)](https://pub.dev/packages/network_info_plus_web) - -A stub implementation of [`network_info_plus`](https://pub.dev/packages/network_info_plus) for Web. - -## Note - -The functionality offered by `network_info_plus` is not supported on Web. This -plugin throws "unsupported" exceptions. - -## Usage - -This package is already included as part of the `network_info_plus` package dependency, and will -be included when using `network_info_plus` as normal. diff --git a/packages/network_info_plus/network_info_plus_web/pubspec.yaml b/packages/network_info_plus/network_info_plus_web/pubspec.yaml deleted file mode 100644 index 33f9fd11ed..0000000000 --- a/packages/network_info_plus/network_info_plus_web/pubspec.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: network_info_plus_web -description: A stub implementation of the Network Info Plus plugin for Web. -version: 1.0.1 -homepage: https://plus.fluttercommunity.dev/ -repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/ - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" - -dependencies: - flutter: - sdk: flutter - flutter_web_plugins: - sdk: flutter - network_info_plus_platform_interface: ^1.0.0 - -flutter: - plugin: - platforms: - web: - pluginClass: NetworkInfoPlusPlugin - fileName: network_info_plus_web.dart diff --git a/packages/network_info_plus/network_info_plus_windows/.gitignore b/packages/network_info_plus/network_info_plus_windows/.gitignore deleted file mode 100644 index e9dc58d3d6..0000000000 --- a/packages/network_info_plus/network_info_plus_windows/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store -.dart_tool/ - -.packages -.pub/ - -build/ diff --git a/packages/network_info_plus/network_info_plus_windows/.metadata b/packages/network_info_plus/network_info_plus_windows/.metadata deleted file mode 100644 index 632500f793..0000000000 --- a/packages/network_info_plus/network_info_plus_windows/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 63062a64432cce03315d6b5196fda7912866eb37 - channel: dev - -project_type: plugin diff --git a/packages/network_info_plus/network_info_plus_windows/CHANGELOG.md b/packages/network_info_plus/network_info_plus_windows/CHANGELOG.md deleted file mode 100644 index dcb7644c1c..0000000000 --- a/packages/network_info_plus/network_info_plus_windows/CHANGELOG.md +++ /dev/null @@ -1,19 +0,0 @@ -## 1.0.2 - -- Fix include order: #242 - -## 1.0.1 - -- Improve documentation - -## 1.0.0 - -- Migrate to null-safety. - -## 0.1.1 - -- Address pub score. - -## 0.1.0 - -- Initial release for Windows. diff --git a/packages/network_info_plus/network_info_plus_windows/LICENSE b/packages/network_info_plus/network_info_plus_windows/LICENSE deleted file mode 100644 index 0c91662b3f..0000000000 --- a/packages/network_info_plus/network_info_plus_windows/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/network_info_plus/network_info_plus_windows/README.md b/packages/network_info_plus/network_info_plus_windows/README.md deleted file mode 100644 index 5a9dda355a..0000000000 --- a/packages/network_info_plus/network_info_plus_windows/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Network Info Plus Windows - -[![Flutter Community: network_info_plus_windows](https://fluttercommunity.dev/_github/header/network_info_plus_windows)](https://github.com/fluttercommunity/community) - -[![pub package](https://img.shields.io/pub/v/network_info_plus_windows.svg)](https://pub.dev/packages/network_info_plus_windows) - -The Windows implementation of [`network_info_plus`](https://pub.dev/packages/network_info_plus). - -## Usage - -This package is already included as part of the `network_info_plus` package dependency, and will -be included when using `network_info_plus` as normal. diff --git a/packages/network_info_plus/network_info_plus_windows/pubspec.yaml b/packages/network_info_plus/network_info_plus_windows/pubspec.yaml deleted file mode 100644 index 745fcc0c0c..0000000000 --- a/packages/network_info_plus/network_info_plus_windows/pubspec.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: network_info_plus_windows -description: Windows implementation of the network_info_plus plugin -homepage: https://plus.fluttercommunity.dev/ -repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/ -version: 1.0.2 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" - -dependencies: - flutter: - sdk: flutter - network_info_plus_platform_interface: ^1.1.2 -dev_dependencies: - flutter_test: - sdk: flutter - flutter_lints: ">=1.0.4 <3.0.0" - -flutter: - plugin: - platforms: - windows: - pluginClass: NetworkInfoPlusWindowsPlugin From 72e71b98a14e6d0dbe83cadee6d93ffa9404e7dc Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Thu, 13 Oct 2022 17:01:03 +0200 Subject: [PATCH 2/6] Use new class name --- .../network_info_plus/test/device_info_plus_linux_test.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/network_info_plus/network_info_plus/test/device_info_plus_linux_test.dart b/packages/network_info_plus/network_info_plus/test/device_info_plus_linux_test.dart index ed573e5d97..c14f79fc8d 100644 --- a/packages/network_info_plus/network_info_plus/test/device_info_plus_linux_test.dart +++ b/packages/network_info_plus/network_info_plus/test/device_info_plus_linux_test.dart @@ -1,10 +1,10 @@ import 'package:flutter_test/flutter_test.dart'; -import 'package:network_info_plus_linux/src/network_info_plus_linux.dart'; +import 'package:network_info_plus/network_info_plus.dart'; import 'package:network_info_plus_platform_interface/network_info_plus_platform_interface.dart'; void main() { test('registered instance', () { - NetworkInfoLinux.registerWith(); - expect(NetworkInfoPlatform.instance, isA()); + NetworkInfoPlusLinuxPlugin.registerWith(); + expect(NetworkInfoPlatform.instance, isA()); }); } From 495492449e9a7c4e886e9366bf644ae6a598ef3e Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Thu, 13 Oct 2022 17:02:32 +0200 Subject: [PATCH 3/6] Fix lints --- .../network_info_plus_test.dart | 21 +++++++++---------- .../network_info_plus/example/lib/main.dart | 12 +++-------- .../network_info_plus/example/pubspec.yaml | 2 ++ 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/packages/network_info_plus/network_info_plus/example/integration_test/network_info_plus_test.dart b/packages/network_info_plus/network_info_plus/example/integration_test/network_info_plus_test.dart index 15a0ffa303..c43cb504e8 100644 --- a/packages/network_info_plus/network_info_plus/example/integration_test/network_info_plus_test.dart +++ b/packages/network_info_plus/network_info_plus/example/integration_test/network_info_plus_test.dart @@ -14,27 +14,26 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('NetworkInfo test driver', () { - NetworkInfo _networkInfo; + NetworkInfo networkInfo; setUpAll(() async { - _networkInfo = NetworkInfo(); + networkInfo = NetworkInfo(); }); testWidgets('test location methods, iOS only', (WidgetTester tester) async { if (Platform.isIOS) { - expect((await _networkInfo.getLocationServiceAuthorization()), - LocationAuthorizationStatus.notDetermined); + expect((await networkInfo.getLocationServiceAuthorization()), LocationAuthorizationStatus.notDetermined); } }, skip: !Platform.isIOS); testWidgets('test non-null network value', (WidgetTester tester) async { - expect(_networkInfo.getWifiName(), isNotNull); - expect(_networkInfo.getWifiBSSID(), isNotNull); - expect(_networkInfo.getWifiIP(), isNotNull); - expect(_networkInfo.getWifiIPv6(), isNotNull); - expect(_networkInfo.getWifiSubmask(), isNotNull); - expect(_networkInfo.getWifiGatewayIP(), isNotNull); - expect(_networkInfo.getWifiBroadcast(), isNotNull); + expect(networkInfo.getWifiName(), isNotNull); + expect(networkInfo.getWifiBSSID(), isNotNull); + expect(networkInfo.getWifiIP(), isNotNull); + expect(networkInfo.getWifiIPv6(), isNotNull); + expect(networkInfo.getWifiSubmask(), isNotNull); + expect(networkInfo.getWifiGatewayIP(), isNotNull); + expect(networkInfo.getWifiBroadcast(), isNotNull); }); }); } diff --git a/packages/network_info_plus/network_info_plus/example/lib/main.dart b/packages/network_info_plus/network_info_plus/example/lib/main.dart index c41cfa9223..313230ec43 100644 --- a/packages/network_info_plus/network_info_plus/example/lib/main.dart +++ b/packages/network_info_plus/network_info_plus/example/lib/main.dart @@ -8,10 +8,10 @@ import 'dart:async'; import 'dart:developer' as developer; import 'dart:io'; -import 'package:network_info_plus/network_info_plus.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:network_info_plus/network_info_plus.dart'; // Sets a platform override for desktop to avoid exceptions. See // https://flutter.dev/desktop#target-platform-override for more info. @@ -48,7 +48,7 @@ class MyHomePage extends StatefulWidget { final String? title; @override - _MyHomePageState createState() => _MyHomePageState(); + State createState() => _MyHomePageState(); } class _MyHomePageState extends State { @@ -86,13 +86,7 @@ class _MyHomePageState extends State { } Future _initNetworkInfo() async { - String? wifiName, - wifiBSSID, - wifiIPv4, - wifiIPv6, - wifiGatewayIP, - wifiBroadcast, - wifiSubmask; + String? wifiName, wifiBSSID, wifiIPv4, wifiIPv6, wifiGatewayIP, wifiBroadcast, wifiSubmask; try { if (!kIsWeb && Platform.isIOS) { diff --git a/packages/network_info_plus/network_info_plus/example/pubspec.yaml b/packages/network_info_plus/network_info_plus/example/pubspec.yaml index 8ecdea6185..a71d25409a 100644 --- a/packages/network_info_plus/network_info_plus/example/pubspec.yaml +++ b/packages/network_info_plus/network_info_plus/example/pubspec.yaml @@ -17,6 +17,8 @@ dependency_overrides: dev_dependencies: flutter_driver: sdk: flutter + flutter_test: + sdk: flutter integration_test: sdk: flutter test: ^1.16.4 From 026b90ee1b21fc547dca25c75996ad484e83b8db Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Thu, 13 Oct 2022 17:23:04 +0200 Subject: [PATCH 4/6] melos run format --- .../network_info_plus_test.dart | 3 +- .../network_info_plus/example/lib/main.dart | 8 +- .../lib/src/network_info_plus_linux.dart | 11 +- .../example/windows/runner/flutter_window.cpp | 8 +- .../example/windows/runner/flutter_window.h | 10 +- .../example/windows/runner/main.cpp | 3 +- .../example/windows/runner/resource.h | 10 +- .../example/windows/runner/utils.cpp | 13 +-- .../example/windows/runner/utils.h | 4 +- .../example/windows/runner/win32_window.cpp | 110 ++++++++---------- .../example/windows/runner/win32_window.h | 21 ++-- 11 files changed, 100 insertions(+), 101 deletions(-) diff --git a/packages/network_info_plus/network_info_plus/example/integration_test/network_info_plus_test.dart b/packages/network_info_plus/network_info_plus/example/integration_test/network_info_plus_test.dart index c43cb504e8..06abdc870d 100644 --- a/packages/network_info_plus/network_info_plus/example/integration_test/network_info_plus_test.dart +++ b/packages/network_info_plus/network_info_plus/example/integration_test/network_info_plus_test.dart @@ -22,7 +22,8 @@ void main() { testWidgets('test location methods, iOS only', (WidgetTester tester) async { if (Platform.isIOS) { - expect((await networkInfo.getLocationServiceAuthorization()), LocationAuthorizationStatus.notDetermined); + expect((await networkInfo.getLocationServiceAuthorization()), + LocationAuthorizationStatus.notDetermined); } }, skip: !Platform.isIOS); diff --git a/packages/network_info_plus/network_info_plus/example/lib/main.dart b/packages/network_info_plus/network_info_plus/example/lib/main.dart index 313230ec43..69a730dc74 100644 --- a/packages/network_info_plus/network_info_plus/example/lib/main.dart +++ b/packages/network_info_plus/network_info_plus/example/lib/main.dart @@ -86,7 +86,13 @@ class _MyHomePageState extends State { } Future _initNetworkInfo() async { - String? wifiName, wifiBSSID, wifiIPv4, wifiIPv6, wifiGatewayIP, wifiBroadcast, wifiSubmask; + String? wifiName, + wifiBSSID, + wifiIPv4, + wifiIPv6, + wifiGatewayIP, + wifiBroadcast, + wifiSubmask; try { if (!kIsWeb && Platform.isIOS) { diff --git a/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_linux.dart b/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_linux.dart index 0c891df8d7..528ae8c7d0 100644 --- a/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_linux.dart +++ b/packages/network_info_plus/network_info_plus/lib/src/network_info_plus_linux.dart @@ -9,7 +9,8 @@ import 'package:nm/nm.dart'; // ignore_for_file: public_member_api_docs typedef _DeviceGetter = Future Function(NetworkManagerDevice? device); -typedef _ConnectionGetter = Future Function(NetworkManagerActiveConnection? connection); +typedef _ConnectionGetter = Future Function( + NetworkManagerActiveConnection? connection); @visibleForTesting typedef NetworkManagerClientFactory = NetworkManagerClient Function(); @@ -75,7 +76,8 @@ class NetworkInfoPlusLinuxPlugin extends NetworkInfoPlatform { Future _getDeviceValue(_DeviceGetter getter) { return _getConnectionValue((connection) { - final device = connection?.devices.firstWhereOrNull((device) => device.wireless != null); + final device = connection?.devices + .firstWhereOrNull((device) => device.wireless != null); return getter(device); }); } @@ -117,7 +119,10 @@ extension _IpInt on int { extension _IpString on String { int toIpInt() { final parts = split('.'); - return parts.intAtOrZero(3) << 24 | parts.intAtOrZero(2) << 16 | parts.intAtOrZero(1) << 8 | parts.intAtOrZero(0); + return parts.intAtOrZero(3) << 24 | + parts.intAtOrZero(2) << 16 | + parts.intAtOrZero(1) << 8 | + parts.intAtOrZero(0); } } diff --git a/packages/package_info_plus/package_info_plus/example/windows/runner/flutter_window.cpp b/packages/package_info_plus/package_info_plus/example/windows/runner/flutter_window.cpp index b43b9095ea..edfe54e14e 100644 --- a/packages/package_info_plus/package_info_plus/example/windows/runner/flutter_window.cpp +++ b/packages/package_info_plus/package_info_plus/example/windows/runner/flutter_window.cpp @@ -4,7 +4,7 @@ #include "flutter/generated_plugin_registrant.h" -FlutterWindow::FlutterWindow(const flutter::DartProject& project) +FlutterWindow::FlutterWindow(const flutter::DartProject &project) : project_(project) {} FlutterWindow::~FlutterWindow() {} @@ -52,9 +52,9 @@ FlutterWindow::MessageHandler(HWND hwnd, UINT const message, } switch (message) { - case WM_FONTCHANGE: - flutter_controller_->engine()->ReloadSystemFonts(); - break; + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; } return Win32Window::MessageHandler(hwnd, message, wparam, lparam); diff --git a/packages/package_info_plus/package_info_plus/example/windows/runner/flutter_window.h b/packages/package_info_plus/package_info_plus/example/windows/runner/flutter_window.h index 6da0652f05..7fa026bf24 100644 --- a/packages/package_info_plus/package_info_plus/example/windows/runner/flutter_window.h +++ b/packages/package_info_plus/package_info_plus/example/windows/runner/flutter_window.h @@ -10,19 +10,19 @@ // A window that does nothing but host a Flutter view. class FlutterWindow : public Win32Window { - public: +public: // Creates a new FlutterWindow hosting a Flutter view running |project|. - explicit FlutterWindow(const flutter::DartProject& project); + explicit FlutterWindow(const flutter::DartProject &project); virtual ~FlutterWindow(); - protected: +protected: // Win32Window: bool OnCreate() override; void OnDestroy() override; LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept override; - private: +private: // The project to run. flutter::DartProject project_; @@ -30,4 +30,4 @@ class FlutterWindow : public Win32Window { std::unique_ptr flutter_controller_; }; -#endif // RUNNER_FLUTTER_WINDOW_H_ +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/packages/package_info_plus/package_info_plus/example/windows/runner/main.cpp b/packages/package_info_plus/package_info_plus/example/windows/runner/main.cpp index bcb57b0e2a..261f186935 100644 --- a/packages/package_info_plus/package_info_plus/example/windows/runner/main.cpp +++ b/packages/package_info_plus/package_info_plus/example/windows/runner/main.cpp @@ -19,8 +19,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, flutter::DartProject project(L"data"); - std::vector command_line_arguments = - GetCommandLineArguments(); + std::vector command_line_arguments = GetCommandLineArguments(); project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); diff --git a/packages/package_info_plus/package_info_plus/example/windows/runner/resource.h b/packages/package_info_plus/package_info_plus/example/windows/runner/resource.h index 66a65d1e4a..d5d958dc42 100644 --- a/packages/package_info_plus/package_info_plus/example/windows/runner/resource.h +++ b/packages/package_info_plus/package_info_plus/example/windows/runner/resource.h @@ -2,15 +2,15 @@ // Microsoft Visual C++ generated include file. // Used by Runner.rc // -#define IDI_APP_ICON 101 +#define IDI_APP_ICON 101 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/packages/package_info_plus/package_info_plus/example/windows/runner/utils.cpp b/packages/package_info_plus/package_info_plus/example/windows/runner/utils.cpp index f5bf9fa0f5..739b61f203 100644 --- a/packages/package_info_plus/package_info_plus/example/windows/runner/utils.cpp +++ b/packages/package_info_plus/package_info_plus/example/windows/runner/utils.cpp @@ -24,7 +24,7 @@ void CreateAndAttachConsole() { std::vector GetCommandLineArguments() { // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. int argc; - wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + wchar_t **argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); if (argv == nullptr) { return std::vector(); } @@ -41,21 +41,20 @@ std::vector GetCommandLineArguments() { return command_line_arguments; } -std::string Utf8FromUtf16(const wchar_t* utf16_string) { +std::string Utf8FromUtf16(const wchar_t *utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, nullptr, 0, nullptr, nullptr); + int target_length = + ::WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, + nullptr, 0, nullptr, nullptr); std::string utf8_string; if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); int converted_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, utf8_string.data(), + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, utf8_string.data(), target_length, nullptr, nullptr); if (converted_length == 0) { return std::string(); diff --git a/packages/package_info_plus/package_info_plus/example/windows/runner/utils.h b/packages/package_info_plus/package_info_plus/example/windows/runner/utils.h index 3879d54755..ff43ce2ce5 100644 --- a/packages/package_info_plus/package_info_plus/example/windows/runner/utils.h +++ b/packages/package_info_plus/package_info_plus/example/windows/runner/utils.h @@ -10,10 +10,10 @@ void CreateAndAttachConsole(); // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string // encoded in UTF-8. Returns an empty std::string on failure. -std::string Utf8FromUtf16(const wchar_t* utf16_string); +std::string Utf8FromUtf16(const wchar_t *utf16_string); // Gets the command line arguments passed in as a std::vector, // encoded in UTF-8. Returns an empty std::vector on failure. std::vector GetCommandLineArguments(); -#endif // RUNNER_UTILS_H_ +#endif // RUNNER_UTILS_H_ diff --git a/packages/package_info_plus/package_info_plus/example/windows/runner/win32_window.cpp b/packages/package_info_plus/package_info_plus/example/windows/runner/win32_window.cpp index c10f08dc7d..90ff01e592 100644 --- a/packages/package_info_plus/package_info_plus/example/windows/runner/win32_window.cpp +++ b/packages/package_info_plus/package_info_plus/example/windows/runner/win32_window.cpp @@ -27,7 +27,7 @@ void EnableFullDpiSupportIfAvailable(HWND hwnd) { return; } auto enable_non_client_dpi_scaling = - reinterpret_cast( + reinterpret_cast( GetProcAddress(user32_module, "EnableNonClientDpiScaling")); if (enable_non_client_dpi_scaling != nullptr) { enable_non_client_dpi_scaling(hwnd); @@ -35,15 +35,15 @@ void EnableFullDpiSupportIfAvailable(HWND hwnd) { } } -} // namespace +} // namespace // Manages the Win32Window's window class registration. class WindowClassRegistrar { - public: +public: ~WindowClassRegistrar() = default; // Returns the singleton registar instance. - static WindowClassRegistrar* GetInstance() { + static WindowClassRegistrar *GetInstance() { if (!instance_) { instance_ = new WindowClassRegistrar(); } @@ -52,23 +52,23 @@ class WindowClassRegistrar { // Returns the name of the window class, registering the class if it hasn't // previously been registered. - const wchar_t* GetWindowClass(); + const wchar_t *GetWindowClass(); // Unregisters the window class. Should only be called if there are no // instances of the window. void UnregisterWindowClass(); - private: +private: WindowClassRegistrar() = default; - static WindowClassRegistrar* instance_; + static WindowClassRegistrar *instance_; bool class_registered_ = false; }; -WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; +WindowClassRegistrar *WindowClassRegistrar::instance_ = nullptr; -const wchar_t* WindowClassRegistrar::GetWindowClass() { +const wchar_t *WindowClassRegistrar::GetWindowClass() { if (!class_registered_) { WNDCLASS window_class{}; window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); @@ -93,21 +93,18 @@ void WindowClassRegistrar::UnregisterWindowClass() { class_registered_ = false; } -Win32Window::Win32Window() { - ++g_active_window_count; -} +Win32Window::Win32Window() { ++g_active_window_count; } Win32Window::~Win32Window() { --g_active_window_count; Destroy(); } -bool Win32Window::CreateAndShow(const std::wstring& title, - const Point& origin, - const Size& size) { +bool Win32Window::CreateAndShow(const std::wstring &title, const Point &origin, + const Size &size) { Destroy(); - const wchar_t* window_class = + const wchar_t *window_class = WindowClassRegistrar::GetInstance()->GetWindowClass(); const POINT target_point = {static_cast(origin.x), @@ -130,19 +127,18 @@ bool Win32Window::CreateAndShow(const std::wstring& title, } // static -LRESULT CALLBACK Win32Window::WndProc(HWND const window, - UINT const message, +LRESULT CALLBACK Win32Window::WndProc(HWND const window, UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept { if (message == WM_NCCREATE) { - auto window_struct = reinterpret_cast(lparam); + auto window_struct = reinterpret_cast(lparam); SetWindowLongPtr(window, GWLP_USERDATA, reinterpret_cast(window_struct->lpCreateParams)); - auto that = static_cast(window_struct->lpCreateParams); + auto that = static_cast(window_struct->lpCreateParams); EnableFullDpiSupportIfAvailable(window); that->window_handle_ = window; - } else if (Win32Window* that = GetThisFromHandle(window)) { + } else if (Win32Window *that = GetThisFromHandle(window)) { return that->MessageHandler(window, message, wparam, lparam); } @@ -150,44 +146,42 @@ LRESULT CALLBACK Win32Window::WndProc(HWND const window, } LRESULT -Win32Window::MessageHandler(HWND hwnd, - UINT const message, - WPARAM const wparam, +Win32Window::MessageHandler(HWND hwnd, UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept { switch (message) { - case WM_DESTROY: - window_handle_ = nullptr; - Destroy(); - if (quit_on_close_) { - PostQuitMessage(0); - } - return 0; - - case WM_DPICHANGED: { - auto newRectSize = reinterpret_cast(lparam); - LONG newWidth = newRectSize->right - newRectSize->left; - LONG newHeight = newRectSize->bottom - newRectSize->top; - - SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, - newHeight, SWP_NOZORDER | SWP_NOACTIVATE); - - return 0; + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); } - case WM_SIZE: { - RECT rect = GetClientArea(); - if (child_content_ != nullptr) { - // Size and position the child window. - MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, - rect.bottom - rect.top, TRUE); - } - return 0; + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); } + return 0; + } - case WM_ACTIVATE: - if (child_content_ != nullptr) { - SetFocus(child_content_); - } - return 0; + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; } return DefWindowProc(window_handle_, message, wparam, lparam); @@ -205,8 +199,8 @@ void Win32Window::Destroy() { } } -Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { - return reinterpret_cast( +Win32Window *Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( GetWindowLongPtr(window, GWLP_USERDATA)); } @@ -227,9 +221,7 @@ RECT Win32Window::GetClientArea() { return frame; } -HWND Win32Window::GetHandle() { - return window_handle_; -} +HWND Win32Window::GetHandle() { return window_handle_; } void Win32Window::SetQuitOnClose(bool quit_on_close) { quit_on_close_ = quit_on_close; diff --git a/packages/package_info_plus/package_info_plus/example/windows/runner/win32_window.h b/packages/package_info_plus/package_info_plus/example/windows/runner/win32_window.h index 17ba431125..7b518125bb 100644 --- a/packages/package_info_plus/package_info_plus/example/windows/runner/win32_window.h +++ b/packages/package_info_plus/package_info_plus/example/windows/runner/win32_window.h @@ -11,7 +11,7 @@ // inherited from by classes that wish to specialize with custom // rendering and input handling class Win32Window { - public: +public: struct Point { unsigned int x; unsigned int y; @@ -34,9 +34,8 @@ class Win32Window { // consistent size to will treat the width height passed in to this function // as logical pixels and scale to appropriate for the default monitor. Returns // true if the window was created successfully. - bool CreateAndShow(const std::wstring& title, - const Point& origin, - const Size& size); + bool CreateAndShow(const std::wstring &title, const Point &origin, + const Size &size); // Release OS resources associated with window. void Destroy(); @@ -54,12 +53,11 @@ class Win32Window { // Return a RECT representing the bounds of the current client area. RECT GetClientArea(); - protected: +protected: // Processes and route salient window messages for mouse handling, // size change and DPI. Delegates handling of these to member overloads that // inheriting classes can handle. - virtual LRESULT MessageHandler(HWND window, - UINT const message, + virtual LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept; @@ -70,7 +68,7 @@ class Win32Window { // Called when Destroy is called. virtual void OnDestroy(); - private: +private: friend class WindowClassRegistrar; // OS callback called by message pump. Handles the WM_NCCREATE message which @@ -78,13 +76,12 @@ class Win32Window { // non-client DPI scaling so that the non-client area automatically // responsponds to changes in DPI. All other messages are handled by // MessageHandler. - static LRESULT CALLBACK WndProc(HWND const window, - UINT const message, + static LRESULT CALLBACK WndProc(HWND const window, UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept; // Retrieves a class instance pointer for |window| - static Win32Window* GetThisFromHandle(HWND const window) noexcept; + static Win32Window *GetThisFromHandle(HWND const window) noexcept; bool quit_on_close_ = false; @@ -95,4 +92,4 @@ class Win32Window { HWND child_content_ = nullptr; }; -#endif // RUNNER_WIN32_WINDOW_H_ +#endif // RUNNER_WIN32_WINDOW_H_ From ccaa016d45694d6b581aead0647710b3df9ba369 Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Fri, 14 Oct 2022 15:36:22 +0200 Subject: [PATCH 5/6] fix: windows build --- .../network_info_plus/example/lib/main.dart | 23 ++++++++++--------- .../network_info_plus/windows/CMakeLists.txt | 6 ++--- .../network_info.h | 0 .../network_info_plus_windows_plugin.h | 0 .../windows/network_info.cpp | 2 +- ...lugin.cpp => network_info_plus_plugin.cpp} | 4 ++-- 6 files changed, 18 insertions(+), 17 deletions(-) rename packages/network_info_plus/network_info_plus/windows/include/{network_info_plus_windows => network_info_plus}/network_info.h (100%) rename packages/network_info_plus/network_info_plus/windows/include/{network_info_plus_windows => network_info_plus}/network_info_plus_windows_plugin.h (100%) rename packages/network_info_plus/network_info_plus/windows/{network_info_plus_windows_plugin.cpp => network_info_plus_plugin.cpp} (95%) diff --git a/packages/network_info_plus/network_info_plus/example/lib/main.dart b/packages/network_info_plus/network_info_plus/example/lib/main.dart index 69a730dc74..3c6597a598 100644 --- a/packages/network_info_plus/network_info_plus/example/lib/main.dart +++ b/packages/network_info_plus/network_info_plus/example/lib/main.dart @@ -142,40 +142,41 @@ class _MyHomePageState extends State { } try { - wifiIPv6 = await _networkInfo.getWifiIPv6(); + if (!Platform.isWindows) { + wifiIPv6 = await _networkInfo.getWifiIPv6(); + } } on PlatformException catch (e) { developer.log('Failed to get Wifi IPv6', error: e); wifiIPv6 = 'Failed to get Wifi IPv6'; } try { - wifiSubmask = await _networkInfo.getWifiSubmask(); + if (!Platform.isWindows) { + wifiSubmask = await _networkInfo.getWifiSubmask(); + } } on PlatformException catch (e) { developer.log('Failed to get Wifi submask address', error: e); wifiSubmask = 'Failed to get Wifi submask address'; } try { - wifiBroadcast = await _networkInfo.getWifiBroadcast(); + if (!Platform.isWindows) { + wifiBroadcast = await _networkInfo.getWifiBroadcast(); + } } on PlatformException catch (e) { developer.log('Failed to get Wifi broadcast', error: e); wifiBroadcast = 'Failed to get Wifi broadcast'; } try { - wifiGatewayIP = await _networkInfo.getWifiGatewayIP(); + if (!Platform.isWindows) { + wifiGatewayIP = await _networkInfo.getWifiGatewayIP(); + } } on PlatformException catch (e) { developer.log('Failed to get Wifi gateway address', error: e); wifiGatewayIP = 'Failed to get Wifi gateway address'; } - try { - wifiSubmask = await _networkInfo.getWifiSubmask(); - } on PlatformException catch (e) { - developer.log('Failed to get Wifi submask', error: e); - wifiSubmask = 'Failed to get Wifi submask'; - } - setState(() { _connectionStatus = 'Wifi Name: $wifiName\n' 'Wifi BSSID: $wifiBSSID\n' diff --git a/packages/network_info_plus/network_info_plus/windows/CMakeLists.txt b/packages/network_info_plus/network_info_plus/windows/CMakeLists.txt index fbef832326..68b57da74c 100644 --- a/packages/network_info_plus/network_info_plus/windows/CMakeLists.txt +++ b/packages/network_info_plus/network_info_plus/windows/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.15) -set(PROJECT_NAME "network_info_plus_windows") +set(PROJECT_NAME "network_info_plus") project(${PROJECT_NAME} LANGUAGES CXX) -set(PLUGIN_NAME "network_info_plus_windows_plugin") +set(PLUGIN_NAME "network_info_plus_plugin") add_library(${PLUGIN_NAME} SHARED "network_info.cpp" -"network_info_plus_windows_plugin.cpp" +"network_info_plus_plugin.cpp" ) apply_standard_settings(${PLUGIN_NAME}) set_target_properties(${PLUGIN_NAME} PROPERTIES diff --git a/packages/network_info_plus/network_info_plus/windows/include/network_info_plus_windows/network_info.h b/packages/network_info_plus/network_info_plus/windows/include/network_info_plus/network_info.h similarity index 100% rename from packages/network_info_plus/network_info_plus/windows/include/network_info_plus_windows/network_info.h rename to packages/network_info_plus/network_info_plus/windows/include/network_info_plus/network_info.h diff --git a/packages/network_info_plus/network_info_plus/windows/include/network_info_plus_windows/network_info_plus_windows_plugin.h b/packages/network_info_plus/network_info_plus/windows/include/network_info_plus/network_info_plus_windows_plugin.h similarity index 100% rename from packages/network_info_plus/network_info_plus/windows/include/network_info_plus_windows/network_info_plus_windows_plugin.h rename to packages/network_info_plus/network_info_plus/windows/include/network_info_plus/network_info_plus_windows_plugin.h diff --git a/packages/network_info_plus/network_info_plus/windows/network_info.cpp b/packages/network_info_plus/network_info_plus/windows/network_info.cpp index 64367e53e0..c45bee3059 100644 --- a/packages/network_info_plus/network_info_plus/windows/network_info.cpp +++ b/packages/network_info_plus/network_info_plus/windows/network_info.cpp @@ -1,4 +1,4 @@ -#include "include/network_info_plus_windows/network_info.h" +#include "include/network_info_plus/network_info.h" #include #include diff --git a/packages/network_info_plus/network_info_plus/windows/network_info_plus_windows_plugin.cpp b/packages/network_info_plus/network_info_plus/windows/network_info_plus_plugin.cpp similarity index 95% rename from packages/network_info_plus/network_info_plus/windows/network_info_plus_windows_plugin.cpp rename to packages/network_info_plus/network_info_plus/windows/network_info_plus_plugin.cpp index bbdab37067..b9395e53e8 100644 --- a/packages/network_info_plus/network_info_plus/windows/network_info_plus_windows_plugin.cpp +++ b/packages/network_info_plus/network_info_plus/windows/network_info_plus_plugin.cpp @@ -1,7 +1,7 @@ // clang-format off -#include "include/network_info_plus_windows/network_info.h" +#include "include/network_info_plus/network_info.h" // clang-format on -#include "include/network_info_plus_windows/network_info_plus_windows_plugin.h" +#include "include/network_info_plus/network_info_plus_windows_plugin.h" #include #include From 0990d1faf1672b7c80bf2e744e7e79edfef1f8ee Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Fri, 14 Oct 2022 15:44:06 +0200 Subject: [PATCH 6/6] fix: duplicated import --- .../network_info_plus/network_info_plus/example/pubspec.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/network_info_plus/network_info_plus/example/pubspec.yaml b/packages/network_info_plus/network_info_plus/example/pubspec.yaml index c441a1233c..a71d25409a 100644 --- a/packages/network_info_plus/network_info_plus/example/pubspec.yaml +++ b/packages/network_info_plus/network_info_plus/example/pubspec.yaml @@ -21,8 +21,6 @@ dev_dependencies: sdk: flutter integration_test: sdk: flutter - flutter_test: - sdk: flutter test: ^1.16.4 flutter_lints: ^2.0.1