搜索插件、代码仓与 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 项

源码仓库

使用此插件的项目