netanchor 1.1.3 copy "netanchor: ^1.1.3" to clipboard
netanchor: ^1.1.3 copied to clipboard

unlisted

A swappable, SOLID-compliant networking layer for Flutter & Dart. Adapter pattern over Dio with refresh-token, retry, cache, pagination, and DataKey unwrapping. Zero UI coupling.

example/lib/main.dart

// ignore_for_file: avoid_print

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

import 'auth/auth_module.dart';
import 'home_page.dart';
import 'net_anchor_setup.dart';

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

class ExampleApp extends StatefulWidget {
  const ExampleApp({super.key});

  @override
  State<ExampleApp> createState() => _ExampleAppState();
}

class _ExampleAppState extends State<ExampleApp> {
  late final EventLog _log;
  late final NetAnchor _netAnchor;
  late final AuthModule _authModule;

  @override
  void initState() {
    super.initState();
    _log = EventLog();
    _netAnchor = buildNetAnchor(_log);
    _authModule = AuthModule(logger: const PrettyNetAnchorLogger());
  }

  @override
  void dispose() {
    _authModule.dispose();
    _netAnchor.close();
    _log.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'netanchor demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(
          seedColor: const Color(0xFF00897B),
          brightness: Brightness.light,
        ),
        cardTheme: CardThemeData(
          elevation: 0,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(16),
            side: BorderSide(
              color: Colors.black.withValues(alpha: 0.06),
            ),
          ),
        ),
      ),
      darkTheme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(
          seedColor: const Color(0xFF00897B),
          brightness: Brightness.dark,
        ),
        cardTheme: CardThemeData(
          elevation: 0,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(16),
            side: BorderSide(
              color: Colors.white.withValues(alpha: 0.08),
            ),
          ),
        ),
      ),
      home: HomePage(
        netAnchor: _netAnchor,
        log: _log,
        authModule: _authModule,
      ),
    );
  }
}
4
likes
0
points
51
downloads

Publisher

verified publisherbasuony.com

Weekly Downloads

A swappable, SOLID-compliant networking layer for Flutter & Dart. Adapter pattern over Dio with refresh-token, retry, cache, pagination, and DataKey unwrapping. Zero UI coupling.

Repository (GitHub)
View/report issues

Topics

#networking #http #dio #rest #api

License

unknown (license)

Dependencies

dio, flutter, meta

More

Packages that depend on netanchor