custom_ping 0.0.1 copy "custom_ping: ^0.0.1" to clipboard
custom_ping: ^0.0.1 copied to clipboard

outdated

A ping service to fix the ping issue on Colombia networks

example/lib/main.dart

import 'dart:async';

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

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

class Example extends StatefulWidget {
  @override
  _ExampleState createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  String service = 'No call';
  StreamSubscription subscription;
  int pingCount = 0;

  @override
  void initState() {
    subscription = PingService().getSubscription(onTrue: (e) {
      setState(() {
        pingCount++;
        service = 'Ping Status $e count: $pingCount';
      });
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Custom Ping',
      home: Scaffold(
        body: SafeArea(
          child: Center(
            child: Text(service),
          ),
        ),
      ),
    );
  }

  @override
  dispose() {
    subscription.cancel();
    super.dispose();
  }
}
12
likes
0
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

A ping service to fix the ping issue on Colombia networks

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http

More

Packages that depend on custom_ping