flutter_offline 4.0.0 copy "flutter_offline: ^4.0.0" to clipboard
flutter_offline: ^4.0.0 copied to clipboard

A tidy utility to handle offline/online connectivity like a Boss.

example/lib/main.dart

import 'package:flutter/material.dart';

import './demo_page.dart';
import './widgets/demo_1.dart';
import './widgets/demo_2.dart';
import './widgets/demo_3.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Offline Demo',
      theme: ThemeData.dark(),
      home: Builder(
        builder: (BuildContext context) {
          return Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              ElevatedButton(
                onPressed: () {
                  navigate(context, const Demo1());
                },
                child: const Text('Demo 1'),
              ),
              ElevatedButton(
                onPressed: () {
                  navigate(context, const Demo2());
                },
                child: const Text('Demo 2'),
              ),
              ElevatedButton(
                onPressed: () {
                  navigate(context, const Demo3());
                },
                child: const Text('Demo 3'),
              ),
            ],
          );
        },
      ),
    );
  }

  void navigate(BuildContext context, Widget widget) {
    Navigator.of(context).push<void>(
      MaterialPageRoute<void>(
        builder: (BuildContext context) => DemoPage(child: widget),
      ),
    );
  }
}
633
likes
140
pub points
97%
popularity

Publisher

verified publisherogbomo.com

A tidy utility to handle offline/online connectivity like a Boss.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

connectivity_plus, flutter, network_info_plus

More

Packages that depend on flutter_offline