easy_db 1.0.0 copy "easy_db: ^1.0.0" to clipboard
easy_db: ^1.0.0 copied to clipboard

The simplest database plugin for Flutter. Just 4 methods and you're done! Perfect for beginners and anyone who hates complex database setup.

Easy_DB #

Flutter License Pub

The simplest database plugin for Flutter. Just 4 methods and you're done!

🎯 Why Easy_DB? #

  • Only 4 methods to learn: init, insert, find, delete
  • Zero setup: No table creation, no schema definitions
  • Beginner friendly: Designed for people who hate complexity
  • Works everywhere: Android, iOS, Web, Desktop (coming soon)

πŸš€ Super Quick Start #

import 'package:easy_db/easy_db.dart';

// Just 4 lines to store and retrieve data!
await EasyDb.init('app.db');
await EasyDb.insert('users', {'name': 'John', 'age': 30});
List<Map<String, dynamic>> users = await EasyDb.find('users');
await EasyDb.close();

πŸ“¦ Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  easy_db: ^1.0.0

Then run:

flutter pub get

πŸ› οΈ Simple Usage #

Store Data #

// Initialize once in your app
await EasyDb.init('my_app.db');

// Store anything - no table setup needed!
await EasyDb.insert('users', {
  'name': 'John Doe',
  'email': 'john@example.com',
  'age': 30,
});

Retrieve Data #

// Get all records
List<Map<String, dynamic>> allUsers = await EasyDb.find('users');

// Get specific records
List<Map<String, dynamic>> adults = await EasyDb.find(
  'users',
  where: 'age >= ?',
  whereArgs: [18],
);

Delete Data #

// Delete specific records
await EasyDb.delete('users', where: 'age < ?', whereArgs: [18]);

🎲 Advanced Features (Still Simple!) #

Update Records #

await EasyDb.update(
  'users', 
  {'age': 31},
  where: 'name = ?', 
  whereArgs: ['John Doe']
);

Raw SQL (When You Need It) #

// Complex queries
List<Map<String, dynamic>> results = await EasyDb.rawQuery(
  'SELECT * FROM users WHERE age > ? ORDER BY name',
  [25]
);

// Custom updates
await EasyDb.rawUpdate(
  'UPDATE users SET age = age + 1 WHERE active = ?',
  [1]
);

Convenience Methods #

// Get first matching record
Map<String, dynamic>? user = await EasyDb.findOne(
  'users',
  where: 'email = ?',
  whereArgs: ['john@example.com']
);

// Check if records exist
bool hasAdults = await EasyDb.exists('users', where: 'age >= ?', whereArgs: [18]);

// Count records
int userCount = await EasyDb.count('users');

πŸ“‹ API Summary #

Method What it does Example
EasyDb.init(dbName) Start using Easy_DB await EasyDb.init('app.db')
EasyDb.insert(table, data) Save data await EasyDb.insert('users', {'name': 'John'})
EasyDb.find(table, {...}) Get data await EasyDb.find('users')
EasyDb.update(table, data, {...}) Change data await EasyDb.update('users', {'age': 31}, ...)
EasyDb.delete(table, {...}) Remove data await EasyDb.delete('users', ...)
EasyDb.close() Clean up await EasyDb.close()

🎯 Perfect For #

  • Beginners who want to store app data without learning SQL
  • Prototypes that need quick data persistence
  • Small apps with simple data storage needs
  • Anyone who hates complex database setup

πŸ“± Example App #

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

void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<Map<String, dynamic>> users = [];

  @override
  void initState() {
    super.initState();
    _loadUsers();
  }

  _loadUsers() async {
    await EasyDb.init('app.db');
    setState(() {
      users = await EasyDb.find('users');
    });
  }

  _addUser() async {
    await EasyDb.insert('users', {
      'name': 'John',
      'email': 'john@example.com',
    });
    _loadUsers(); // Refresh the list
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Users: ${users.length}')),
        body: ListView.builder(
          itemCount: users.length,
          itemBuilder: (context, index) {
            final user = users[index];
            return ListTile(
              title: Text(user['name']),
              subtitle: Text(user['email']),
            );
          },
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: _addUser,
          child: const Icon(Icons.add),
        ),
      ),
    );
  }
}

πŸš€ Getting Started #

  1. Add easy_db to your pubspec.yaml
  2. Run flutter pub get
  3. Import and use:
    import 'package:easy_db/easy_db.dart';
    
  4. Start storing data in 2 lines!

πŸ“š Platform Support #

Platform Status
Android βœ… Ready
iOS ❌ Coming soon
Web ❌ Coming soon
Desktop ❌ Coming soon

🀝 Contributing #

Want to help? Great!

  1. Fork the repo
  2. Make it even simpler
  3. Send a pull request

πŸ“„ License #

MIT - Do whatever you want with it!

πŸ‘¨β€πŸ’» Author #

itsaqibdev - Making Flutter development easier for everyone

0
likes
150
points
53
downloads

Publisher

verified publishertelegrambotmaker.app

Weekly Downloads

The simplest database plugin for Flutter. Just 4 methods and you're done! Perfect for beginners and anyone who hates complex database setup.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on easy_db

Packages that implement easy_db