Search packages, repositories and app categories

Package detailsv2.0.0

sql_conn

Universal production-ready Flutter SQL connector using JDBC and secure pooled connections.

Android
30-day downloads
137
Likes
52
Pub points
150

Install package

flutter pub add sql_conn

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

sql_conn is a production-ready Flutter SQL connector designed for secure, efficient database interactions using JDBC. It provides pooled connections to optimize performance and ensure reliability in high-load environments. Built with security in mind, it supports encrypted communication and connection pooling across Android platforms. Ideal for apps requiring robust backend database integration with minimal latency. The package simplifies SQL operations while maintaining scalability and thread safety.

Use cases

  • Connecting Flutter apps to remote databases
  • Handling high-volume database queries
  • Securing database connections in production
  • Enabling persistent connection pools
  • Integrating with existing JDBC-compatible databases
  • Supporting Android-only database deployments

Key features

  • JDBC-based connectivity
  • Secure connection pooling
  • Production-grade stability
  • Android platform support
  • Encrypted data transmission
  • Thread-safe operations

Suitable for

  • Enterprise Flutter applications
  • High-traffic database-backed apps
  • Apps requiring secure database access
  • Developers using JDBC-compatible databases
  • Teams prioritizing connection efficiency
  • Android-focused database integrations

Considerations

  • Limited to Android platform
  • Requires JDBC driver compatibility
  • Needs proper configuration for SSL
  • May require additional setup for complex schemas
  • Not suitable for iOS or web
  • Depends on external JDBC infrastructure

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

sql_conn

sql_conn is a production-ready Flutter plugin that allows Android applications to connect directly to SQL SERVER databases using JDBC.

It provides a clean, type-safe, null-safe Dart API powered by Pigeon, and a high-performance Android backend.

This plugin is designed for LAN / internal network / enterprise / industrial use-cases where direct database connectivity from a mobile device is required.


✨ Features

  • Android-only direct SQL connectivity
  • Database support:
    • Microsoft SQL Server
  • Prepared statements (parameterized queries)
  • Stored procedure execution
  • SQL script / batch execution
  • Fully null-safe Dart API
  • Type-safe Flutter ↔ Android bridge using Pigeon

📱 Platform Support

Platform Support
Android ✅ Yes
iOS 🚧 Under construction
Web 💭 Planning
Windows 🚫 No
MacOs 🚫 No

Direct database connections from mobile apps should only be used in trusted or internal networks.


🚀 Installation

Add to pubspec.yaml:

dependencies:
  sql_conn: ^2.0.0

⚙️ Basic Usage

Connect to a database
await SqlConn.connect(
  connectionId: "mainDB",
  host: "192.168.1.10",
  port: 1433,
  database: "MyDatabase",
  username: "admin",
  password: "Password@123",
);
Read data
final rows = await SqlConn.read(
  "mainDB",
  "SELECT * FROM users WHERE role = ?",
  params: ["admin"],
);

print(rows);
Write / Update / Delete
final count = await SqlConn.write(
  "mainDB",
  "UPDATE users SET active = ? WHERE id = ?",
  params: [true, 101],
);

print("Rows affected: $count");
Call Stored Procedure
final result = await SqlConn.callProcedure(
  "mainDB",
  "sp_generate_report",
  params: [2026, "JAN"],
);
Execute SQL Script
await SqlConn.executeScript(
  "mainDB",
  """
  CREATE TABLE logs(id INT, message VARCHAR(255));
  CREATE INDEX idx_logs ON logs(id);
  """,
);
Disconnect
await SqlConn.disconnect("mainDB");
🧩 Multiple Connections
await SqlConn.connect(connectionId: "db1", dbType: DatabaseType.sqlServer, ...);
await SqlConn.connect(connectionId: "db2", dbType: DatabaseType.postgres, ...);

final a = await SqlConn.read("db1", "SELECT * FROM table1");
final b = await SqlConn.read("db2", "SELECT * FROM table2");
🔧 Custom JDBC URL
await SqlConn.connect(
  connectionId: "legacy",
  host: "",
  port: 0,
  database: "",
  username: "sysdba",
  password: "masterkey",
  customJdbcUrl: "jdbc:firebirdsql://192.168.1.9/employee",
);

🧠 State Management

sql_conn is a stateless service API. You can integrate it with any state manager:

  • Provider
  • Riverpod
  • Bloc
  • GetX
  • Service Locators
  • Connection lifecycle is fully controlled by your app.

⚡ Performance

  • Prepared statement reuse
  • Non-blocking platform channel
  • Minimal memory overhead

🔐 Security

  • Prepared statements prevent SQL injection
  • No credential logging

Categories

Source repository

Projects using this package

No data available yet.