diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index c52b050..186f18c 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -39,7 +39,7 @@ jobs: run: flutter --version - name: Cache pubspec dependencies - uses: actions/cache@v4.1.2 + uses: actions/cache@v4.2.4 with: path: | ${{ env.FLUTTER_HOME }}/.pub-cache @@ -51,18 +51,6 @@ jobs: restore-keys: | build-pubspec- - - name: Cache build runner - uses: actions/cache@v4.1.2 - with: - path: | - **/.dart_tool - **/*.g.dart - **/*.mocks.dart - **/*.config.dart - key: build-runner-${{ hashFiles('**/asset_graph.json', '**/*.dart', '**/pubspec.lock', '**/outputs.json') }} - restore-keys: | - build-runner- - - name: Download pub dependencies run: flutter pub get diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 07b6054..7985567 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,7 +39,6 @@ jobs: needs: 'test' permissions: id-token: write # Required for authentication using OIDC - uses: git-elliot/setup-dart/.github/workflows/publish.yml@main # Added build_runner step + uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 with: - environment: 'pub.dev' - build_runner: false \ No newline at end of file + environment: 'pub.dev' \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d2e0f4..7100a88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## 3.0.0 +Performance improvements + ## 2.0.7 Scan fixed for android diff --git a/README.md b/README.md index c73cc2a..fd4cb96 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,12 @@ And initialize the pacakge in the main function await configureNetworkToolsFlutter((await getApplicationDocumentsDirectory()).path); ``` -From here please follow the documentation of [network_tools](https://pub.dev/packages/network_tools) as they are the same. + +## Example + +See the [example](example/) directory for a complete Flutter app using this package. + +From here please follow the documentation of [network_tools](https://pub.dev/packages/network_tools) as they are the same. ## mDNS search diff --git a/example/.gitignore b/example/.gitignore index 24476c5..7d798d7 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -1,3 +1,8 @@ +# Ignore all generated plugin registrant and plugins files across platforms +**/flutter/generated_plugin_registrant.* +**/flutter/generated_plugins.* +**/Flutter/GeneratedPluginRegistrant.* + # Miscellaneous *.class *.log @@ -5,9 +10,11 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ migrate_working_dir/ # IntelliJ related @@ -31,6 +38,7 @@ migrate_working_dir/ .pub-cache/ .pub/ /build/ +/pubspec.lock # Symbolication related app.*.symbols diff --git a/example/README.md b/example/README.md index 2b3fce4..6f2160f 100644 --- a/example/README.md +++ b/example/README.md @@ -1,16 +1,18 @@ -# example - -A new Flutter project. +samples, guidance on mobile development, and a full API reference. -## Getting Started +# Example for network_tools_flutter -This project is a starting point for a Flutter application. +This example demonstrates how to use the `network_tools_flutter` package in a Flutter app. -A few resources to get you started if this is your first Flutter project: +```dart +import 'package:network_tools_flutter/network_tools_flutter.dart'; +import 'package:path_provider/path_provider.dart'; -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) +Future main() async { + final appDocDirectory = await getApplicationDocumentsDirectory(); + await configureNetworkToolsFlutter(appDocDirectory.path, enableDebugging: true); + // Now you can use the network_tools_flutter APIs +} +``` -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +For a complete example, see the code in this directory. diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 85f0605..4a62c21 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -28,12 +28,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { @@ -45,7 +45,7 @@ android { applicationId "org.fsociety.network_tools_flutter_example.example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion 21 + minSdkVersion flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/example/android/build.gradle b/example/android/build.gradle index f7eb7f6..c3c9108 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.7.22' repositories { google() mavenCentral() diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 55c4ca8..8a906a8 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -17,4 +17,4 @@ pluginManagement { include ":app" -apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" + diff --git a/example/linux/flutter/generated_plugin_registrant.cc b/example/linux/flutter/generated_plugin_registrant.cc deleted file mode 100644 index e71a16d..0000000 --- a/example/linux/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,11 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - - -void fl_register_plugins(FlPluginRegistry* registry) { -} diff --git a/example/linux/flutter/generated_plugin_registrant.h b/example/linux/flutter/generated_plugin_registrant.h deleted file mode 100644 index e0f0a47..0000000 --- a/example/linux/flutter/generated_plugin_registrant.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#ifndef GENERATED_PLUGIN_REGISTRANT_ -#define GENERATED_PLUGIN_REGISTRANT_ - -#include - -// Registers Flutter plugins. -void fl_register_plugins(FlPluginRegistry* registry); - -#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/example/linux/flutter/generated_plugins.cmake b/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87..0000000 --- a/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift deleted file mode 100644 index 2844b6d..0000000 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// Generated file. Do not edit. -// - -import FlutterMacOS -import Foundation - -import nsd_macos -import path_provider_foundation - -func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - NsdMacosPlugin.register(with: registry.registrar(forPlugin: "NsdMacosPlugin")) - PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) -} diff --git a/example/macos/Podfile b/example/macos/Podfile index c795730..b52666a 100644 --- a/example/macos/Podfile +++ b/example/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.14' +platform :osx, '10.15' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index a9883a3..bdc28de 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -1,23 +1,29 @@ PODS: - FlutterMacOS (1.0.0) + - nsd_macos (0.0.1): + - FlutterMacOS - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS DEPENDENCIES: - FlutterMacOS (from `Flutter/ephemeral`) + - nsd_macos (from `Flutter/ephemeral/.symlinks/plugins/nsd_macos/macos`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) EXTERNAL SOURCES: FlutterMacOS: :path: Flutter/ephemeral + nsd_macos: + :path: Flutter/ephemeral/.symlinks/plugins/nsd_macos/macos path_provider_foundation: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin SPEC CHECKSUMS: - FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 + FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1 + nsd_macos: a472240e770b92f6c6df1022403aa29c90d012e3 + path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 -PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 +PODFILE CHECKSUM: 9ebaf0ce3d369aaa26a9ea0e159195ed94724cf3 -COCOAPODS: 1.12.0 +COCOAPODS: 1.16.2 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 7de041e..67c0a06 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -259,7 +259,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C80D4294CF70F00263BE5 = { @@ -553,7 +553,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -632,7 +632,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -679,7 +679,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 397f3d3..ac78810 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ diff --git a/example/macos/Runner/AppDelegate.swift b/example/macos/Runner/AppDelegate.swift index d53ef64..b3c1761 100644 --- a/example/macos/Runner/AppDelegate.swift +++ b/example/macos/Runner/AppDelegate.swift @@ -1,9 +1,13 @@ import Cocoa import FlutterMacOS -@NSApplicationMain +@main class AppDelegate: FlutterAppDelegate { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } } diff --git a/example/pubspec.lock b/example/pubspec.lock deleted file mode 100644 index 9e858d6..0000000 --- a/example/pubspec.lock +++ /dev/null @@ -1,564 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - args: - dependency: transitive - description: - name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" - url: "https://pub.dev" - source: hosted - version: "2.5.0" - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.dev" - source: hosted - version: "1.3.0" - clock: - dependency: transitive - description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" - source: hosted - version: "1.1.1" - collection: - dependency: transitive - description: - name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.dev" - source: hosted - version: "1.18.0" - crypto: - dependency: transitive - description: - name: crypto - sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 - url: "https://pub.dev" - source: hosted - version: "3.0.5" - csv: - dependency: transitive - description: - name: csv - sha256: c6aa2679b2a18cb57652920f674488d89712efaf4d3fdf2e537215b35fc19d6c - url: "https://pub.dev" - source: hosted - version: "6.0.0" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" - dart_ping: - dependency: transitive - description: - name: dart_ping - sha256: "2f5418d0a5c64e53486caaac78677b25725b1e13c33c5be834ce874ea18bd24f" - url: "https://pub.dev" - source: hosted - version: "9.0.1" - dart_ping_ios: - dependency: transitive - description: - name: dart_ping_ios - sha256: "17df1b369331ec6c30a91a51db64ac8feed47fad71e444208de06edf2a22415f" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - ffi: - dependency: transitive - description: - name: ffi - sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" - url: "https://pub.dev" - source: hosted - version: "2.1.3" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be - url: "https://pub.dev" - source: hosted - version: "1.1.1" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_icmp_ping: - dependency: transitive - description: - name: flutter_icmp_ping - sha256: de9633cf65a8c733fae29d08a35d3d4b343620cd1d13e1bfa88eccf56696d896 - url: "https://pub.dev" - source: hosted - version: "3.1.3" - flutter_isolate: - dependency: transitive - description: - name: flutter_isolate - sha256: "36a84e1a22371d8092ea2121145b330c24fb272acb951fb30c60ba44926b8fb3" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 - url: "https://pub.dev" - source: hosted - version: "2.0.3" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - http: - dependency: transitive - description: - name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 - url: "https://pub.dev" - source: hosted - version: "1.2.2" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - intl: - dependency: transitive - description: - name: intl - sha256: "99f282cb0e02edcbbf8c6b3bbc7c90b65635156c412e58f3975a7e55284ce685" - url: "https://pub.dev" - source: hosted - version: "0.20.0" - json_annotation: - dependency: transitive - description: - name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" - url: "https://pub.dev" - source: hosted - version: "4.9.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" - url: "https://pub.dev" - source: hosted - version: "10.0.5" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" - url: "https://pub.dev" - source: hosted - version: "3.0.5" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" - url: "https://pub.dev" - source: hosted - version: "3.0.1" - lints: - dependency: transitive - description: - name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - logging: - dependency: "direct main" - description: - name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 - url: "https://pub.dev" - source: hosted - version: "1.3.0" - matcher: - dependency: transitive - description: - name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.dev" - source: hosted - version: "0.12.16+1" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 - url: "https://pub.dev" - source: hosted - version: "1.15.0" - multicast_dns: - dependency: transitive - description: - name: multicast_dns - sha256: "982c4cc4cda5f98dd477bddfd623e8e4bd1014e7dbf9e7b05052e14a5b550b99" - url: "https://pub.dev" - source: hosted - version: "0.3.2+7" - nested: - dependency: transitive - description: - name: nested - sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - network_tools: - dependency: transitive - description: - name: network_tools - sha256: cf5726a3c3edd82de5f6d6511cb618259a083225ccc2bdb8a55d87b37014cadf - url: "https://pub.dev" - source: hosted - version: "5.0.2" - network_tools_flutter: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "2.0.3" - nsd: - dependency: transitive - description: - name: nsd - sha256: b20c4e7b11b40085163c2736c27e3d450c3970512ddab7ea5f144586fb0105d3 - url: "https://pub.dev" - source: hosted - version: "3.0.0" - nsd_android: - dependency: transitive - description: - name: nsd_android - sha256: "9e2c1d31a36c9b7f5bad6329f3d9e07c7f09e7a7394aa2f54db701516ac149eb" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - nsd_ios: - dependency: transitive - description: - name: nsd_ios - sha256: "43b53bdcf0cedf7c481125e6a7e4a88c745de2e48a205404be3b4e91d77798b5" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - nsd_macos: - dependency: transitive - description: - name: nsd_macos - sha256: db1a07f4baf358b9d72ff9eb308c83419c60a57ef8c6d1e0369075825b835b43 - url: "https://pub.dev" - source: hosted - version: "2.0.0" - nsd_platform_interface: - dependency: transitive - description: - name: nsd_platform_interface - sha256: "726bba1b93e18a37252623fd6490bafe6f3d7c225bff50421b7eeb7c47704d4b" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - nsd_windows: - dependency: transitive - description: - name: nsd_windows - sha256: "78910ac981ae0ab975cf4c30895512576220aed3dd57c3378a05eebe8e13ff88" - url: "https://pub.dev" - source: hosted - version: "3.0.0" - path: - dependency: transitive - description: - name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.dev" - source: hosted - version: "1.9.0" - path_provider: - dependency: "direct main" - description: - name: path_provider - sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" - url: "https://pub.dev" - source: hosted - version: "2.1.5" - path_provider_android: - dependency: transitive - description: - name: path_provider_android - sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" - url: "https://pub.dev" - source: hosted - version: "2.2.10" - path_provider_foundation: - dependency: transitive - description: - name: path_provider_foundation - sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 - url: "https://pub.dev" - source: hosted - version: "2.4.0" - path_provider_linux: - dependency: transitive - description: - name: path_provider_linux - sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.dev" - source: hosted - version: "2.2.1" - path_provider_platform_interface: - dependency: transitive - description: - name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - path_provider_windows: - dependency: transitive - description: - name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 - url: "https://pub.dev" - source: hosted - version: "2.3.0" - platform: - dependency: transitive - description: - name: platform - sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" - url: "https://pub.dev" - source: hosted - version: "3.1.5" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.dev" - source: hosted - version: "2.1.8" - process_run: - dependency: transitive - description: - name: process_run - sha256: "8d9c6198b98fbbfb511edd42e7364e24d85c163e47398919871b952dc86a423e" - url: "https://pub.dev" - source: hosted - version: "0.14.2" - provider: - dependency: transitive - description: - name: provider - sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c - url: "https://pub.dev" - source: hosted - version: "6.1.2" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - sembast: - dependency: transitive - description: - name: sembast - sha256: "481e0a4199015e0050ee4b42d59d51731b1fb324a1eea5c24557fa72335790b0" - url: "https://pub.dev" - source: hosted - version: "3.7.3+2" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" - source: hosted - version: "1.10.0" - sprintf: - dependency: transitive - description: - name: sprintf - sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" - url: "https://pub.dev" - source: hosted - version: "7.0.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.dev" - source: hosted - version: "1.11.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.dev" - source: hosted - version: "2.1.2" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - synchronized: - dependency: transitive - description: - name: synchronized - sha256: a824e842b8a054f91a728b783c177c1e4731f6b124f9192468457a8913371255 - url: "https://pub.dev" - source: hosted - version: "3.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" - url: "https://pub.dev" - source: hosted - version: "0.7.2" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" - source: hosted - version: "1.3.2" - universal_io: - dependency: transitive - description: - name: universal_io - sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" - url: "https://pub.dev" - source: hosted - version: "2.2.2" - uuid: - dependency: transitive - description: - name: uuid - sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff - url: "https://pub.dev" - source: hosted - version: "4.5.1" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" - url: "https://pub.dev" - source: hosted - version: "14.2.5" - web: - dependency: transitive - description: - name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" - url: "https://pub.dev" - source: hosted - version: "0.5.1" - xdg_directories: - dependency: transitive - description: - name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d - url: "https://pub.dev" - source: hosted - version: "1.0.4" - yaml: - dependency: transitive - description: - name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" - url: "https://pub.dev" - source: hosted - version: "3.1.2" -sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.22.0" diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc deleted file mode 100644 index 1be4edb..0000000 --- a/example/windows/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,14 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - -#include - -void RegisterPlugins(flutter::PluginRegistry* registry) { - NsdWindowsPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("NsdWindowsPluginCApi")); -} diff --git a/example/windows/flutter/generated_plugin_registrant.h b/example/windows/flutter/generated_plugin_registrant.h deleted file mode 100644 index dc139d8..0000000 --- a/example/windows/flutter/generated_plugin_registrant.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#ifndef GENERATED_PLUGIN_REGISTRANT_ -#define GENERATED_PLUGIN_REGISTRANT_ - -#include - -// Registers Flutter plugins. -void RegisterPlugins(flutter::PluginRegistry* registry); - -#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index 3429ffa..0000000 --- a/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - nsd_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/lib/src/configure_flutter.dart b/lib/src/configure_flutter.dart index eb0462b..7a00f1b 100644 --- a/lib/src/configure_flutter.dart +++ b/lib/src/configure_flutter.dart @@ -4,7 +4,7 @@ import 'package:network_tools/network_tools.dart' as packages_page; // ignore: implementation_imports import 'package:network_tools/src/services/arp_service.dart'; // ignore: implementation_imports -import 'package:network_tools/src/services/impls/arp_service_sembast_impl.dart'; +import 'package:network_tools/src/services/impls/arp_service_drift_impl.dart'; // ignore: implementation_imports import 'package:network_tools_flutter/src/network_tools_flutter_util.dart'; import 'package:network_tools_flutter/src/services_impls/host_scanner_service_flutter_impl.dart'; @@ -12,6 +12,13 @@ import 'package:network_tools_flutter/src/services_impls/mdns_scanner_service_fl import 'package:network_tools_flutter/src/services_impls/port_scanner_service_flutter_impl.dart'; import 'package:universal_io/io.dart'; +/// Configures the network tools for Flutter. +/// +/// [dbDirectory] is the directory for the database. +/// [enableDebugging] enables verbose logging if set to true. +/// +/// This function sets up implementations for ARP, host, port, and mDNS scanning services, +/// initializes the ARP table, and registers DartPing for iOS if needed. Future configureNetworkToolsFlutter( String dbDirectory, { bool enableDebugging = false, @@ -32,7 +39,7 @@ Future configureNetworkToolsFlutter( } // Setting dart native classes implementations - ARPServiceSembastImpl(); + ARPServiceDriftImpl(); // Setting flutter classes implementation HostScannerServiceFlutterImpl(); diff --git a/lib/src/services_impls/host_scanner_service_flutter_impl.dart b/lib/src/services_impls/host_scanner_service_flutter_impl.dart index 70f154b..e4c75ba 100644 --- a/lib/src/services_impls/host_scanner_service_flutter_impl.dart +++ b/lib/src/services_impls/host_scanner_service_flutter_impl.dart @@ -13,11 +13,17 @@ import 'package:network_tools/src/services/impls/host_scanner_service_impl.dart' /// Scans for all hosts in a subnet. @pragma('vm:entry-point') class HostScannerServiceFlutterImpl extends HostScannerServiceImpl { - /// Scans for all hosts in a particular subnet (e.g., 192.168.1.0/24) - /// Set maxHost to higher value if you are not getting results. - /// It won't firstHostId again unless previous scan is completed due to heavy - /// resource consumption. - /// [resultsInAddressAscendingOrder] = false will return results faster but not in order + /// Scans for all hosts in a particular subnet (e.g., 192.168.1.0/24). + /// + /// [subnet] The subnet to scan. + /// [firstHostId] The first host ID to scan. + /// [lastHostId] The last host ID to scan. + /// [timeoutInSeconds] Timeout for each ping in seconds. + /// [hostIds] Specific host IDs to scan. + /// [progressCallback] Callback for scan progress. + /// [resultsInAddressAscendingOrder] If false, results may be returned faster but unordered. + /// + /// Returns a [Stream] of [ActiveHost] found in the subnet. @override @pragma('vm:entry-point') Stream getAllPingableDevices( diff --git a/lib/src/services_impls/mdns_scanner_service_flutter_impl.dart b/lib/src/services_impls/mdns_scanner_service_flutter_impl.dart index f23b02a..4f03340 100644 --- a/lib/src/services_impls/mdns_scanner_service_flutter_impl.dart +++ b/lib/src/services_impls/mdns_scanner_service_flutter_impl.dart @@ -20,9 +20,15 @@ import 'package:network_tools/src/services/impls/mdns_scanner_service_impl.dart' // Directory appDocDirectory; // } +@pragma('vm:entry-point') class MdnsScannerServiceFlutterImpl extends MdnsScannerServiceImpl { // TODO: Swtich to improved searchMdnsDevices method when https://github.com/Skyost/Bonsoir/issues/86 is resolved + /// Finds mDNS devices with their addresses for the given [serviceType]. + /// + /// [serviceType] The mDNS service type to search for. + /// + /// Returns a [Future] that completes with a list of [ActiveHost] found. @override Future> findingMdnsWithAddress( String serviceType, diff --git a/lib/src/services_impls/port_scanner_service_flutter_impl.dart b/lib/src/services_impls/port_scanner_service_flutter_impl.dart index 54170a3..408ed27 100644 --- a/lib/src/services_impls/port_scanner_service_flutter_impl.dart +++ b/lib/src/services_impls/port_scanner_service_flutter_impl.dart @@ -7,8 +7,15 @@ import 'package:network_tools/network_tools.dart'; import 'package:network_tools/src/services/impls/port_scanner_service_impl.dart'; /// Flutter flavor of PortScannerService.instance, only use if your project is based of flutter. +@pragma('vm:entry-point') class PortScannerServiceFlutterImpl extends PortScannerServiceImpl { /// Checks if the single [port] is open or not for the [target]. + /// + /// [target] The target host to check. + /// [port] The port to check. + /// [timeout] Timeout duration for the check. + /// + /// Returns a [Future] that completes with an [ActiveHost] if the port is open, otherwise null. @override Future isOpen( String target, @@ -21,11 +28,16 @@ class PortScannerServiceFlutterImpl extends PortScannerServiceImpl { return super.isOpen(target, port, timeout: timeout); } - /// Scans ports only listed in [portList] for a [target]. Progress can be - /// retrieved by [progressCallback] - /// Tries connecting ports before until [timeout] reached. - /// [resultsInAddressAscendingOrder] = false will return results faster but not in - /// ascending order and without [progressCallback]. + /// Scans only the ports listed in [portList] for a [target]. + /// + /// [target] The target host to scan. + /// [portList] List of ports to scan. + /// [progressCallback] Callback for scan progress. + /// [timeout] Timeout for each port scan. + /// [resultsInAddressAscendingOrder] If false, results may be returned faster but unordered. + /// [async] If true, runs asynchronously. + /// + /// Returns a [Stream] of [ActiveHost] for open ports. @override Stream customDiscover( String target, { @@ -46,9 +58,17 @@ class PortScannerServiceFlutterImpl extends PortScannerServiceImpl { async: async); } - /// Scans port from [startPort] to [endPort] of [target]. Progress can be - /// retrieved by [progressCallback] - /// Tries connecting ports before until [timeout] reached. + /// Scans ports from [startPort] to [endPort] of [target]. + /// + /// [target] The target host to scan. + /// [startPort] The starting port number. + /// [endPort] The ending port number. + /// [progressCallback] Callback for scan progress. + /// [timeout] Timeout for each port scan. + /// [resultsInAddressAscendingOrder] If false, results may be returned faster but unordered. + /// [async] If true, runs asynchronously. + /// + /// Returns a [Stream] of [ActiveHost] for open ports in the range. @override Stream scanPortsForSingleDevice( String target, { @@ -71,6 +91,15 @@ class PortScannerServiceFlutterImpl extends PortScannerServiceImpl { async: async); } + /// Attempts to connect to a specific [port] on an [address]. + /// + /// [address] The address to connect to. + /// [port] The port to connect to. + /// [timeout] Timeout for the connection attempt. + /// [activeHostsController] Controller to report active hosts. + /// [recursionCount] Number of recursive attempts. + /// + /// Returns a [Future] that completes with an [ActiveHost] if the connection is successful, otherwise null. @override Future connectToPort({ required String address, diff --git a/pubspec.yaml b/pubspec.yaml index 768bb58..84c91d4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: network_tools_flutter description: Extended features of network_tools package for flutter framework supporting iOS and Android -version: 2.0.7 +version: 3.0.0 issue_tracker: https://github.com/osociety/network_tools_flutter/issues repository: https://github.com/osociety/network_tools_flutter @@ -37,7 +37,7 @@ dependencies: logging: ^1.3.0 # Deal with internationalized/localized messages and more. intl: ^0.20.0 - network_tools: ^5.0.2 + network_tools: ^6.0.1 path_provider: ^2.1.5 universal_io: ^2.2.2 nsd: ">=3.0.0 <5.0.0"