cozy_data 0.0.1-dev.1 copy "cozy_data: ^0.0.1-dev.1" to clipboard
cozy_data: ^0.0.1-dev.1 copied to clipboard

retracted

A Swift-inspired persistent data management solution for Flutter. Provides simple, powerful, and type-safe way to persist your app's models with automatic UI updates.

example/lib/main.dart

import 'package:cozy_data/cozy_data.dart';
import 'package:cozy_data_example/full_example/full_example.dart';
import 'package:cozy_data_example/full_example/model/recipe.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'simple_example/model/person.dart';
import 'simple_example/simple_example.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await CozyData.initialize(schemas: [PersonSchema, RecipeSchema]);
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Cozy Data Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        scaffoldBackgroundColor: const Color.fromRGBO(242, 242, 247, 1),
      ),
      home: const Examples(),
    );
  }
}

// Example usage in a Flutter widget
class Examples extends StatefulWidget {
  const Examples({super.key});

  @override
  _ExamplesState createState() => _ExamplesState();
}

class _ExamplesState extends State<Examples> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          ElevatedButton(
            onPressed: () {
              Navigator.push(
                context,
                MaterialPageRoute(builder: (context) => const SimpleExample()),
              );
            },
            child: const Text(
              "Simple Example",
              style: TextStyle(color: CupertinoColors.activeBlue),
            ),
          ),
          const SizedBox(height: 20),
          ElevatedButton(
            onPressed: () {
              Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => const FullExample(),
                ),
              );
            },
            child: const Text(
              "Full Example",
              style: TextStyle(color: CupertinoColors.activeBlue),
            ),
          ),
        ],
      ),
    ));
  }
}
4
likes
0
pub points
0%
popularity

Publisher

verified publisherdoumbouya.dev

A Swift-inspired persistent data management solution for Flutter. Provides simple, powerful, and type-safe way to persist your app's models with automatic UI updates.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

build, flutter, isar, isar_flutter_libs, path_provider, source_gen

More

Packages that depend on cozy_data