flutter_icmp_ping 1.0.0+1 copy "flutter_icmp_ping: ^1.0.0+1" to clipboard
flutter_icmp_ping: ^1.0.0+1 copied to clipboard

outdated

Flutter plugin that sends ICMP ECHO_REQUEST to network hosts.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_icmp_ping/flutter_icmp_ping.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    void startPing() async {
      try {
        final proc = await Ping.start(
          'google.com',
          count: 3,
          timeout: 1,
          interval: 1,
          ipv6: false,
        );
        proc.listen((event) {
          print(event);
        });
      } catch (e) {
        print('error $e');
      }
    }

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Ping example app'),
        ),
        body: Center(
          child: Column(
            children: [
              RaisedButton(
                child: Text('start'),
                onPressed: startPing,
              ),
              RaisedButton(
                child: Text('stop'),
                onPressed: () {
                  Ping.stop();
                },
              )
            ],
          ),
        ),
      ),
    );
  }
}
13
likes
0
pub points
89%
popularity

Publisher

verified publisherzuvola.com

Flutter plugin that sends ICMP ECHO_REQUEST to network hosts.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

async, flutter

More

Packages that depend on flutter_icmp_ping