zuraffa 5.4.0 copy "zuraffa: ^5.4.0" to clipboard
zuraffa: ^5.4.0 copied to clipboard

AI first Flutter Clean Architecture Framework and CLI with Result types, UseCase patterns, Dependency Injection and MCP server for building type-safe, scalable apps with AI agents.

example/lib/main.dart

import 'dart:developer' as developer;

import 'package:example/src/domain/domain.dart';
import 'package:example/src/presentation/pages/todo/todo_view.dart';
import 'package:flutter/material.dart';
import 'package:zuraffa/zuraffa.dart';
import 'package:example/src/api/bridges/todo_api_bridge.dart';
import './src/di/index.dart' as auto_di;
import './src/cache/index.dart' as auto_cache;

final getIt = GetIt.instance;

Future<void> setupDependencies() async {
  auto_di.setupDependencies(getIt);
  await Hive.initFlutter();
  await auto_cache.initAllCaches();
}

void _initializeBridge() {
  debugPrint('🔧 _initializeBridge: init + register');
  ZuraffaApiBridge.init();
  registerTodoApiBridge();

  // Test: register a simple extension to verify the mechanism works
  developer.registerExtension('ext.test.ping', (method, params) async {
    return developer.ServiceExtensionResponse.result('pong');
  });

  debugPrint('🔧 _initializeBridge: done');
}

void main() {
  Zuraffa.enableLogging();
  WidgetsFlutterBinding.ensureInitialized();
  setupDependencies()
      .then((_) {
        runApp(const ZuraffaExampleApp());
        _initializeBridge();
      })
      .catchError((Object error, StackTrace st) {
        debugPrint('❌ setupDependencies failed: $error');
        debugPrintStack(stackTrace: st);
        runApp(const ZuraffaExampleApp());
        _initializeBridge();
      });
}

/// Example app demonstrating Zuraffa Clean Architecture.
class ZuraffaExampleApp extends StatelessWidget {
  const ZuraffaExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Zuraffa Clean Architecture Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
        useMaterial3: true,
      ),
      home: TodoView(todoRepository: getIt<TodoRepository>()),
    );
  }
}
2
likes
0
points
688
downloads

Documentation

Documentation

Publisher

verified publisherzuzu.dev

Weekly Downloads

AI first Flutter Clean Architecture Framework and CLI with Result types, UseCase patterns, Dependency Injection and MCP server for building type-safe, scalable apps with AI agents.

Homepage
Repository (GitHub)
View/report issues

Topics

#clean-architecture #state-management #dependency-injection #architecture #code-generation

License

unknown (license)

Dependencies

analyzer, args, code_builder, dart_style, flutter, get, get_it, glob, go_router, hive_ce, hive_ce_flutter, hive_ce_generator, http, json_annotation, json_serializable, logging, meta, minio, opentelemetry, path, provider, responsive_builder, uuid, zorphy, zorphy_annotation

More

Packages that depend on zuraffa