搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.5+0

speed_test_dart

使用 speedtest.net 的網路速度測試工具(ping、上傳、下載)

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
23
喜歡數
41
Pub 分數
135

安裝套件

flutter pub add speed_test_dart

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter/Dart 套件,可在多個平台實現網路速度測試,使用 speedtest.net 基礎設施來測量 ping、上傳和下載速度。它提供簡單的 API,可將即時網路效能檢測整合至應用程式中,支援 Android、iOS、Web、macOS、Windows 與 Linux。非常適合用於應用程式中的診斷、網路監控或效能評估功能,需要可靠的速度資料。

適用情境

  • 網路性能監控
  • 應用診斷工具
  • 互聯網品質評估
  • 即時頻寬測試
  • 用戶連接反饋
  • 不同網路之間的速度對比

主要特色

  • 支援 ping、上傳和下載測試
  • 使用 speedtest.net 伺服器
  • 跨平台相容性
  • 簡單的異步 API
  • 輕量且易於整合
  • 即時速度指標

適合對象

  • 開發網路工具的開發者
  • 需要連接性檢查的應用程式
  • 效能基準測試工具
  • 行動和桌面診斷應用
  • 教育或測試應用

使用建議

  • 依賴外部 speedtest.net 服務
  • 可能需要使用者權限才能存取網路
  • 結果取決於伺服器的接近程度
  • 不適用於高頻率測試
  • 測試參數的自訂有限
  • 網路狀況會影響準確性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

speed_test_dart

Forked from speed_test_port

Flutter package to test ping, upload, download using speedtest.net

Optimizations

Some refactors, more customization and better error handling. Now the test are done from a server list and if one server fails, it will try the next one.

Installation

Add the package to your dependencies:

dependencies:
  speed_test_dart: ^1.0.0

Finally, run dart pub get to download the package.

Projects using this library should use the stable channel of Flutter

Startup

At the startup of the app, we need to get the best servers to do the test (see setBestServers function). It's recommended to disabled the buttons while this operation is happening:

Startup

Download Speed

Doing download test:

Download test

Upload Speed

Doing upload test:

Upload test

Example of usage

    // Create a tester instance
    SpeedTestDart tester = SpeedTestDart();

    // And a variable to store the best servers
    List<Server> bestServersList = [];

    // Example function to set the best servers, could be called
    // in an initState()
    Future<void> setBestServers() async {
      final settings = await tester.getSettings();
      final servers = settings.servers;

      final _bestServersList = await tester.getBestServers(
        servers: servers,
      );

      setState(() {
        bestServersList = _bestServersList;
      });
    }

    //Test download speed in MB/s
    final downloadRate =
        await tester.testDownloadSpeed(servers: bestServersList);

    //Test upload speed in MB/s
    final uploadRate = await tester.testUploadSpeed(servers: bestServersList);

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案