https://github.com/reclast/fluttermysqlconnect
Mysql connection and controls for Flutter.
https://github.com/reclast/fluttermysqlconnect
flutter flutter-app flutter-apps mysql mysql-database mysql-server
Last synced: about 2 months ago
JSON representation
Mysql connection and controls for Flutter.
- Host: GitHub
- URL: https://github.com/reclast/fluttermysqlconnect
- Owner: RecLast
- License: mit
- Created: 2025-01-20T22:51:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-23T13:31:53.000Z (over 1 year ago)
- Last Synced: 2025-02-23T14:30:04.634Z (over 1 year ago)
- Topics: flutter, flutter-app, flutter-apps, mysql, mysql-database, mysql-server
- Language: Dart
- Homepage:
- Size: 1.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flutter MySQL Connect
A secure authentication application using Flutter with MySQL database
connection.

## π Contents
- [Features](#features)
- [Setup](#setup)
- [Database Configuration](#database-configuration)
- [Authentication Structure](#authentication-structure)
- [Theme Structure](#theme-structure)
- [Language Management](#language-management)
- [Error Handling](#error-handling)
- [Security](#security)
- [Architecture](#architecture)
- [Folder Structure](#folder-structure)
## β¨Features
- π Secure MySQL connection
- π Encryption MYSQL Information
- π Authentication (Login/Register)
- π NetworkControl/DatabaseControl/Login Control (Splash Screen)
- π Password encryption with BCrypt
- π TR/EN language support
- π¨ Customizable theme
- π± Responsive design
- β‘ Performance optimization
## βοΈSetup
### Requirements
β’ Flutter SDK (>=3.2.3)
β’ MySQL Server
β’ MySQL Workbench (recommended)
### Steps
1. Clone the project:
git clone https://github.com/RecLast/FlutterMysqlConnect.git
2. Install dependencies:
flutter pub get
## πΎDatabase Configuration
### 1. Create Database
CREATE DATABASE flutter_mysql_connect;
### 2. Table Structure
CREATE TABLE users (
id INT PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
### 3. Secure Connection Configuration
To configure MySQL connection information securely:
1. Edit `lib/core/utils/config_generator.dart` file:
final config = {
'host': 'localhost',
'port': '3306',
'user': 'your_username',
'password': 'your_password',
'db': 'your_database'
};
2. Run the config generator:
dart run lib/core/utils/config_generator.dart
3. Generated encrypted config file: `assets/config/db_config.enc`
::: info
**π Security:** Connection information is protected with XOR encryption
and SHA-256.
:::
## πAuthentication Structure
The authentication system is configured under `features/auth` with MVVM
architecture:
features/auth/
βββ model/
β βββ user_model.dart # User data model
βββ view/
β βββ sign_view.dart # Login/Register screen
β βββ splash_view.dart # Splash screen
βββ viewmodel/
βββ auth_view_model.dart # Authentication business logic
### Authentication Flow
1. Session check in splash screen
2. Login/Register form validation
3. Password hashing with BCrypt
4. JWT token management
## π¨Theme Structure
Theme management is centrally configured under `core/theme`:
core/theme/
βββ app_colors.dart # Color palettes
βββ app_text_styles.dart # Typography styles
βββ app_theme.dart # Theme configuration
::: info
**π‘ Customization:** All colors and styles can be managed from a single
point.
:::
### Theme Usage
// Color usage
color: AppColors.darkBlue['primary']
// Text style usage
style: AppTextStyles.ubuntuBold.copyWith(
fontSize: 24,
color: Colors.white,
)
## πLanguage Management
Multi-language support is configured under `core/init/lang`:
core/init/lang/
βββ locale_keys.dart # Language keys
βββ locale_manager.dart # Language manager
βββ translations/ # Language files
βββ tr.json
βββ en.json
### Language Usage
// Change language
LocaleManager.instance.setLocale(const Locale('en', 'US'));
// Text translation
Text(LocaleKeys.welcome.tr())
## β οΈError Handling
Central error management is configured under `core/base`:
core/base/
βββ error/
β βββ base_error.dart # Base error class
β βββ network_error.dart # Network errors
β βββ database_error.dart # Database errors
βββ result/
βββ result_model.dart # Result model
### Error Handling Usage
try {
await operation();
} on NetworkError catch (e) {
showErrorDialog(e.message);
} on DatabaseError catch (e) {
logError(e);
showErrorSnackbar(e.message);
}
::: warning
**π Error Tracking:** All errors are centrally logged and appropriate
messages are shown to the user.
:::
## πSecurity
### Encryption
- Secure password hashing with BCrypt
- Sensitive data encryption with AES-256
- Secure connection with SSL/TLS
### SQL Injection Protection
// Unsafe Usage β
"SELECT * FROM users WHERE username = '$username'"
// Safe Usage β
"SELECT * FROM users WHERE username = ?"
## ποΈ Architecture
The project is developed using MVVM (Model-View-ViewModel) architecture:
- **Model:** Data structures and database operations
- **View:** UI components
- **ViewModel:** Business logic and state management
## πFolder Structure
lib/
βββ core/
β βββ init/
β β βββ database/ # MySQL connection management
β β βββ encryption/ # Encryption services
β β βββ lang/ # Language management
β βββ services/ # General services
β βββ theme/ # Theme configuration
β βββ utils/ # Helper utilities
βββ features/
βββ auth/ # Authentication
β βββ model/
β βββ view/
β βββ viewmodel/
βββ home/ # Home page
βββ model/
βββ view/
βββ viewmodel/
::: info
**π‘ Tip:** Visit our [Wiki
page](https://github.com/RecLast/FlutterMysqlConnect/wiki) for detailed
code examples and API documentation.
:::
## π Contact
For questions and suggestions:
Β© 2025 Flutter MySQL Connect. Developed by [Γmit
Eski](www.umiteski.com.tr). Licensed under MIT License.