juice_connectivity 0.1.0 copy "juice_connectivity: ^0.1.0" to clipboard
juice_connectivity: ^0.1.0 copied to clipboard

Network reachability as a Juice bloc — online/offline and connection-type state behind a swappable provider seam.

example/lib/main.dart

import 'package:juice/juice.dart';
import 'package:juice_connectivity/juice_connectivity.dart';

import 'demo_connectivity_provider.dart';
import 'home_screen.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  // Demo provider so the app runs with no device/network. Swap for
  // ConnectivityConfig() (default ConnectivityPlusProvider) in a real app.
  BlocScope.register<ConnectivityBloc>(
    () => ConnectivityBloc.withConfig(
      ConnectivityConfig(provider: DemoConnectivityProvider()),
    ),
    lifecycle: BlocLifecycle.permanent,
  );

  runApp(const DemoApp());
}

class DemoApp extends StatelessWidget {
  const DemoApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'juice_connectivity demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.teal),
        useMaterial3: true,
      ),
      home: HomeScreen(),
    );
  }
}
0
likes
140
points
16
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Network reachability as a Juice bloc — online/offline and connection-type state behind a swappable provider seam.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#connectivity #network #bloc #state-management #offline

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

connectivity_plus, flutter, juice

More

Packages that depend on juice_connectivity