Change database directory & add readme

This commit is contained in:
Linloir 2022-10-09 21:15:52 +08:00
parent bb13789271
commit eae2ceb3eb
No known key found for this signature in database
GPG Key ID: 58EEB209A0F2C366
3 changed files with 28 additions and 6 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
.packages
.tmp/
.data/
.data/**
# Conventional directory for build output.

View File

@ -1,2 +1,22 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.
# Simple TCP Server
This is ~~a project of my Computer Internet course~~ a project inspired by my school homework.
Several days before I'm asked to write a project on TCP server-client communication, and I wondered why not build a simple chat service beyond that which would be much more fun?
Therefore here it is, a simple tcp server with several functions which makes it acts like a small chat app.
## Functions
- User register / login / logout
- Remember login state for device (simple token approach though)
- Send messages via users
- Search users and add contacts (and accept them of course)
- Message sync via different devices
- Send message to offline server (a SMTP-like approach)
- File handling (transfer to and fetch from server)
## Notice
- To support multilanguage, use `base64Encode(utf8.encode(yourMessageHere))` before wrapping client messages in json object and sending that to the server (the serve will crash!)
- Always open a new TCP connection to fetch or send file

View File

@ -1,7 +1,7 @@
/*
* @Author : Linloir
* @Date : 2022-10-06 16:15:01
* @LastEditTime : 2022-10-09 20:28:49
* @LastEditTime : 2022-10-09 20:31:23
* @Description :
*/
@ -25,12 +25,12 @@ class DataBaseHelper {
Future<void> initialize() async {
_database = await databaseFactoryFfi.openDatabase(
'E:\\database.db',
'${Directory.current.path}/.tmp/database.db',
options: OpenDatabaseOptions(
version: 1,
onCreate: (db, version) {
onCreate: (db, version) async {
print('[L] Creating Database.');
db.execute(
await db.execute(
'''
CREATE TABLE users (
userid integer primary key autoincrement,
@ -77,6 +77,7 @@ class DataBaseHelper {
);
'''
);
print('[L] Database created');
},
)
);