Открыть боковую панель
Aurora OS
Flutter
Flutter Community Plugins
sqlite3.dart
Коммиты
d6c70e11
Коммит
d6c70e11
создал
Окт 15, 2024
по автору
Vladimir Vershinin
Зафиксировано автором
Красавин Никита Сергеевич
Окт 15, 2024
Просмотр файлов
[change] Preparing the plugin for publication.
владелец
9c1945e0
Изменения
13
Скрыть пробелы
Построчно
Рядом
.gitignore
Просмотр файла @
d6c70e11
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
.packages
.packages
build/
build/
# If you're building an application, you may want to check-in your pubspec.lock
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock
/
pubspec.lock
# Directory created by dartdoc
# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
# If you don't generate documentation locally you can remove this line.
...
...
LICENSE
Просмотр файла @
d6c70e11
MIT License
MIT License
Copyright (c) 2024 Open Mobile Platform LLC <community@omp.ru>
Copyright (c) 2020 Simon Binder
Copyright (c) 2020 Simon Binder
Permission is hereby granted, free of charge, to any person obtaining a copy
Permission is hereby granted, free of charge, to any person obtaining a copy
...
...
sqlite3_flutter_libs/CHANGELOG.md
Просмотр файла @
d6c70e11
## Updated: 10/0
4
/2024 1
2:59:55
PM
## Updated: 10/0
9
/2024 1
3:40:30
PM
## Info
## Info
-
Last tag: None
-
Last tag: aurora-sqlite3_flutter_libs-0.5.25
-
Released: 0
-
Released: 1
## Versions
-
Version: aurora-sqlite3_flutter_libs-0.5.25 (04/10/2024)
sqlite3_flutter_libs/LICENSE
Просмотр файла @
d6c70e11
MIT License
MIT License
Copyright (c) 2024 Open Mobile Platform LLC <community@omp.ru>
Copyright (c) 2020 Simon Binder
Copyright (c) 2020 Simon Binder
Permission is hereby granted, free of charge, to any person obtaining a copy
Permission is hereby granted, free of charge, to any person obtaining a copy
...
...
sqlite3_flutter_libs/README.md
Просмотр файла @
d6c70e11
...
@@ -24,7 +24,7 @@ dependencies:
...
@@ -24,7 +24,7 @@ dependencies:
sqlite3_flutter_libs
:
sqlite3_flutter_libs
:
git
:
git
:
url
:
https://gitlab.com/omprussia/flutter/flutter-community-plugins/sqlite3.dart.git
url
:
https://gitlab.com/omprussia/flutter/flutter-community-plugins/sqlite3.dart.git
ref
:
sqlite3_flutter_libs-0.5.2
4-aurora
ref
:
aurora-
sqlite3_flutter_libs-0.5.2
6
path
:
sqlite3_flutter_libs/
path
:
sqlite3_flutter_libs/
```
```
...
...
sqlite3_flutter_libs/example/.gitignore
Просмотр файла @
d6c70e11
...
@@ -32,7 +32,6 @@ android
...
@@ -32,7 +32,6 @@ android
.pub-cache/
.pub-cache/
.pub/
.pub/
/build/
/build/
pubspec.lock
#Metadata
#Metadata
.metadata
.metadata
...
...
sqlite3_flutter_libs/example/aurora/.gitignore
Просмотр файла @
d6c70e11
flutter
/ephemeral
/
flutter
sqlite3_flutter_libs/example/lib/form_widget.dart
удалено
100644 → 0
Просмотр файла @
9c1945e0
// SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import
'package:flutter/material.dart'
;
import
'package:internal_aurora/list_button.dart'
;
import
'package:internal_aurora/theme/colors.dart'
;
import
'plugin_impl.dart'
;
/// Keys form demo
enum
FormTypeKeys
{
insert
,
update
}
/// Form focus input
class
FormWidget
extends
StatefulWidget
{
const
FormWidget
({
super
.
key
,
required
this
.
impl
,
required
this
.
type
});
final
PluginImpl
impl
;
final
FormTypeKeys
type
;
@override
State
<
FormWidget
>
createState
()
=
>
_FormWidgetState
();
}
class
_FormWidgetState
extends
State
<
FormWidget
>
{
final
_formKey
=
GlobalKey
<
FormState
>();
bool
_errorUpdate
=
false
;
final
TextEditingController
_idEdit
=
TextEditingController
();
final
TextEditingController
_intEdit
=
TextEditingController
();
final
TextEditingController
_doubleEdit
=
TextEditingController
();
final
TextEditingController
_stringEdit
=
TextEditingController
();
@override
Widget
build
(
BuildContext
context
)
{
return
Form
(
key:
_formKey
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
/// Field ID
if
(
widget
.
type
==
FormTypeKeys
.
update
)
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
16
),
child:
TextFormField
(
controller:
_idEdit
,
keyboardType:
TextInputType
.
number
,
decoration:
InputDecoration
(
labelText:
'Specify "
${ValueKeys.id.name.toUpperCase()}
"'
,
),
validator:
(
value
)
{
if
(
_errorUpdate
)
{
return
'
${ValueKeys.id.name.toUpperCase()}
not found.'
;
}
if
(
int
.
tryParse
(
value
??
''
)
==
null
)
{
return
'The parameter type must be "
${ValueKeys.int.name}
"'
;
}
return
null
;
},
),
),
/// Field ValueKeys.int
TextFormField
(
controller:
_intEdit
,
keyboardType:
TextInputType
.
number
,
decoration:
InputDecoration
(
labelText:
'Specify type "
${ValueKeys.int.name}
"'
,
),
validator:
(
value
)
{
if
(
int
.
tryParse
(
value
??
''
)
==
null
)
{
return
'The parameter type must be "
${ValueKeys.int.name}
"'
;
}
return
null
;
},
),
const
SizedBox
(
height:
16.0
),
/// Field ValueKeys.double
TextFormField
(
controller:
_doubleEdit
,
keyboardType:
TextInputType
.
number
,
decoration:
InputDecoration
(
labelText:
'Specify type "
${ValueKeys.double.name}
"'
,
),
validator:
(
value
)
{
if
(
double
.
tryParse
(
value
?.
replaceAll
(
','
,
'.'
)
??
''
)
==
null
)
{
return
'The parameter type must be "
${ValueKeys.double.name}
"'
;
}
return
null
;
},
),
const
SizedBox
(
height:
16
),
/// Field ValueKeys.string
TextFormField
(
controller:
_stringEdit
,
decoration:
InputDecoration
(
labelText:
'Specify type "
${ValueKeys.string.name}
"'
,
),
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
'The parameter "
${ValueKeys.string.name}
" not must be empty.'
;
}
if
(
value
.
length
>
10
)
{
return
'The parameter "
${ValueKeys.string.name}
" max length 10 symbols.'
;
}
return
null
;
},
),
const
SizedBox
(
height:
16.0
),
/// Button submit
ListButton
(
'
${widget.type.name}
data'
,
InternalColors
.
green
,
onPressed:
()
async
{
// Clear error update
_errorUpdate
=
false
;
// Validate all form
if
(
_formKey
.
currentState
?.
validate
()
==
true
)
{
// Get values
final
id
=
_idEdit
.
text
;
final
valueInt
=
_intEdit
.
text
;
final
valueDouble
=
_doubleEdit
.
text
.
replaceAll
(
','
,
'.'
);
final
valueString
=
_stringEdit
.
text
;
// Update database data
if
(
widget
.
type
==
FormTypeKeys
.
insert
)
{
await
widget
.
impl
.
insert
(
valueInt:
int
.
parse
(
valueInt
),
valueDouble:
double
.
parse
(
valueDouble
),
valueString:
valueString
,
);
}
if
(
widget
.
type
==
FormTypeKeys
.
update
)
{
// Update with result
_errorUpdate
=
!
await
widget
.
impl
.
update
(
id:
int
.
parse
(
id
),
valueInt:
int
.
parse
(
valueInt
),
valueDouble:
double
.
parse
(
valueDouble
),
valueString:
valueString
,
);
// Validate after update
_formKey
.
currentState
?.
validate
();
}
// If not error update clear form
if
(
!
_errorUpdate
)
{
// Clear form
_idEdit
.
clear
();
_intEdit
.
clear
();
_doubleEdit
.
clear
();
_stringEdit
.
clear
();
// Close keyboard
if
(
context
.
mounted
)
FocusScope
.
of
(
context
)
.
unfocus
();
}
}
setState
(()
{});
},
),
],
),
);
}
}
sqlite3_flutter_libs/example/lib/main.dart
Просмотр файла @
d6c70e11
...
@@ -11,8 +11,8 @@ import 'package:internal_aurora/list_separated.dart';
...
@@ -11,8 +11,8 @@ import 'package:internal_aurora/list_separated.dart';
import
'package:internal_aurora/theme/colors.dart'
;
import
'package:internal_aurora/theme/colors.dart'
;
import
'package:internal_aurora/theme/theme.dart'
;
import
'package:internal_aurora/theme/theme.dart'
;
import
'
form_widget
.dart'
;
import
'
package:path/path
.dart'
as
p
;
import
'p
lugin_impl
.dart'
;
import
'p
ackage:sqflite_common_ffi/sqflite_ffi
.dart'
;
void
main
()
{
void
main
()
{
runApp
(
const
MyApp
());
runApp
(
const
MyApp
());
...
@@ -46,7 +46,8 @@ class _MyAppState extends State<MyApp> {
...
@@ -46,7 +46,8 @@ class _MyAppState extends State<MyApp> {
curve:
Curves
.
easeOut
,
curve:
Curves
.
easeOut
,
duration:
const
Duration
(
milliseconds:
500
),
duration:
const
Duration
(
milliseconds:
500
),
);
);
Future
.
delayed
(
const
Duration
(
seconds:
2
),
()
=
>
setState
(()
=
>
_showSuccess
=
false
));
Future
.
delayed
(
const
Duration
(
seconds:
2
),
()
=
>
setState
(()
=
>
_showSuccess
=
false
));
});
});
}
else
{
}
else
{
_showSuccess
=
false
;
_showSuccess
=
false
;
...
@@ -71,7 +72,8 @@ class _MyAppState extends State<MyApp> {
...
@@ -71,7 +72,8 @@ class _MyAppState extends State<MyApp> {
"""
),
"""
),
/// Success update data
/// Success update data
if
(
_showSuccess
==
true
)
const
ListItemInfoSuccess
(
'Data updated successfully!'
),
if
(
_showSuccess
==
true
)
const
ListItemInfoSuccess
(
'Data updated successfully!'
),
/// Button for clear Sqflite
/// Button for clear Sqflite
if
(
_dataIsEmpty
==
false
&&
_showSuccess
!=
true
)
if
(
_dataIsEmpty
==
false
&&
_showSuccess
!=
true
)
...
@@ -100,7 +102,9 @@ class _MyAppState extends State<MyApp> {
...
@@ -100,7 +102,9 @@ class _MyAppState extends State<MyApp> {
columns:
[
'Name'
,
'Value'
]
columns:
[
'Name'
,
'Value'
]
.
map
((
name
)
=
>
DataColumn
(
.
map
((
name
)
=
>
DataColumn
(
label:
Expanded
(
label:
Expanded
(
child:
Text
(
name
,
style:
const
TextStyle
(
fontStyle:
FontStyle
.
italic
)),
child:
Text
(
name
,
style:
const
TextStyle
(
fontStyle:
FontStyle
.
italic
)),
),
),
))
))
.
toList
(),
.
toList
(),
...
@@ -151,3 +155,296 @@ class _MyAppState extends State<MyApp> {
...
@@ -151,3 +155,296 @@ class _MyAppState extends State<MyApp> {
);
);
}
}
}
}
/// Keys form demo
enum
FormTypeKeys
{
insert
,
update
}
/// Form focus input
class
FormWidget
extends
StatefulWidget
{
const
FormWidget
({
super
.
key
,
required
this
.
impl
,
required
this
.
type
});
final
PluginImpl
impl
;
final
FormTypeKeys
type
;
@override
State
<
FormWidget
>
createState
()
=
>
_FormWidgetState
();
}
class
_FormWidgetState
extends
State
<
FormWidget
>
{
final
_formKey
=
GlobalKey
<
FormState
>();
bool
_errorUpdate
=
false
;
final
TextEditingController
_idEdit
=
TextEditingController
();
final
TextEditingController
_intEdit
=
TextEditingController
();
final
TextEditingController
_doubleEdit
=
TextEditingController
();
final
TextEditingController
_stringEdit
=
TextEditingController
();
@override
Widget
build
(
BuildContext
context
)
{
return
Form
(
key:
_formKey
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
/// Field ID
if
(
widget
.
type
==
FormTypeKeys
.
update
)
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
16
),
child:
TextFormField
(
controller:
_idEdit
,
keyboardType:
TextInputType
.
number
,
decoration:
InputDecoration
(
labelText:
'Specify "
${ValueKeys.id.name.toUpperCase()}
"'
,
),
validator:
(
value
)
{
if
(
_errorUpdate
)
{
return
'
${ValueKeys.id.name.toUpperCase()}
not found.'
;
}
if
(
int
.
tryParse
(
value
??
''
)
==
null
)
{
return
'The parameter type must be "
${ValueKeys.int.name}
"'
;
}
return
null
;
},
),
),
/// Field ValueKeys.int
TextFormField
(
controller:
_intEdit
,
keyboardType:
TextInputType
.
number
,
decoration:
InputDecoration
(
labelText:
'Specify type "
${ValueKeys.int.name}
"'
,
),
validator:
(
value
)
{
if
(
int
.
tryParse
(
value
??
''
)
==
null
)
{
return
'The parameter type must be "
${ValueKeys.int.name}
"'
;
}
return
null
;
},
),
const
SizedBox
(
height:
16.0
),
/// Field ValueKeys.double
TextFormField
(
controller:
_doubleEdit
,
keyboardType:
TextInputType
.
number
,
decoration:
InputDecoration
(
labelText:
'Specify type "
${ValueKeys.double.name}
"'
,
),
validator:
(
value
)
{
if
(
double
.
tryParse
(
value
?.
replaceAll
(
','
,
'.'
)
??
''
)
==
null
)
{
return
'The parameter type must be "
${ValueKeys.double.name}
"'
;
}
return
null
;
},
),
const
SizedBox
(
height:
16
),
/// Field ValueKeys.string
TextFormField
(
controller:
_stringEdit
,
decoration:
InputDecoration
(
labelText:
'Specify type "
${ValueKeys.string.name}
"'
,
),
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
'The parameter "
${ValueKeys.string.name}
" not must be empty.'
;
}
if
(
value
.
length
>
10
)
{
return
'The parameter "
${ValueKeys.string.name}
" max length 10 symbols.'
;
}
return
null
;
},
),
const
SizedBox
(
height:
16.0
),
/// Button submit
ListButton
(
'
${widget.type.name}
data'
,
InternalColors
.
green
,
onPressed:
()
async
{
// Clear error update
_errorUpdate
=
false
;
// Validate all form
if
(
_formKey
.
currentState
?.
validate
()
==
true
)
{
// Get values
final
id
=
_idEdit
.
text
;
final
valueInt
=
_intEdit
.
text
;
final
valueDouble
=
_doubleEdit
.
text
.
replaceAll
(
','
,
'.'
);
final
valueString
=
_stringEdit
.
text
;
// Update database data
if
(
widget
.
type
==
FormTypeKeys
.
insert
)
{
await
widget
.
impl
.
insert
(
valueInt:
int
.
parse
(
valueInt
),
valueDouble:
double
.
parse
(
valueDouble
),
valueString:
valueString
,
);
}
if
(
widget
.
type
==
FormTypeKeys
.
update
)
{
// Update with result
_errorUpdate
=
!
await
widget
.
impl
.
update
(
id:
int
.
parse
(
id
),
valueInt:
int
.
parse
(
valueInt
),
valueDouble:
double
.
parse
(
valueDouble
),
valueString:
valueString
,
);
// Validate after update
_formKey
.
currentState
?.
validate
();
}
// If not error update clear form
if
(
!
_errorUpdate
)
{
// Clear form
_idEdit
.
clear
();
_intEdit
.
clear
();
_doubleEdit
.
clear
();
_stringEdit
.
clear
();
// Close keyboard
if
(
context
.
mounted
)
FocusScope
.
of
(
context
)
.
unfocus
();
}
}
setState
(()
{});
},
),
],
),
);
}
}
/// Keys form demo
enum
ValueKeys
{
id
,
int
,
double
,
string
}
/// Table name
const
table
=
'Test'
;
/// Main features of the plugin sqflite
class
PluginImpl
{
/// Get instance Database
Database
?
_db
;
/// Stream for update values sqflite
/// from form
StreamController
<
bool
>
?
_streamController
;
/// Check save data to Database
Stream
<
bool
>
isEmptyStream
()
{
_streamController
??=
StreamController
<
bool
>(
onListen:
()
async
{
// Init db
await
init
();
// Check is empty
_streamController
!.
add
(
await
isEmpty
());
},
onCancel:
()
async
{
// Close db
await
close
();
});
return
_streamController
!.
stream
;
}
/// Check is table not empty
Future
<
bool
>
isEmpty
()
async
{
final
rows
=
await
_db
?.
rawQuery
(
'SELECT COUNT(rowid) as count FROM
$table
'
,
);
if
(
rows
!=
null
&&
rows
.
isNotEmpty
&&
rows
[
0
]
.
containsKey
(
'count'
))
{
return
rows
[
0
][
'count'
]
==
0
;
}
return
true
;
}
/// Init database
Future
<
void
>
init
()
async
{
// set up databaseFactory by databaseFactoryFfi for sqflite_common_ffi
databaseFactory
=
databaseFactoryFfi
;
// Get a location using getDatabasesPath
var
databasesPath
=
await
getDatabasesPath
();
String
path
=
p
.
join
(
databasesPath
,
'demo.db'
);
// Open the database
_db
=
await
openDatabase
(
path
,
version:
1
,
onCreate:
(
Database
db
,
int
version
)
async
{
// When creating the db, create the table
await
db
.
execute
(
'''CREATE TABLE
$table
(
val_int INTEGER,
val_double REAL,
val_str TEXT
) STRICT'''
);
// STRICT able only for libsqlite version >= 3.37
},
);
}
/// Close database
Future
<
void
>
close
()
async
{
await
_db
?.
close
();
}
/// Get value from Database
Future
<
Map
<
ValueKeys
,
dynamic
>
?
>
getValues
()
async
{
final
rows
=
await
_db
?.
rawQuery
(
'SELECT rowid as id, * FROM
$table
'
);
if
(
rows
!=
null
&&
rows
.
isNotEmpty
&&
rows
[
0
]
.
containsKey
(
'id'
))
{
return
{
ValueKeys
.
id
:
rows
[
0
][
'id'
],
ValueKeys
.
int
:
rows
[
0
][
'val_int'
],
ValueKeys
.
double
:
rows
[
0
][
'val_double'
],
ValueKeys
.
string
:
rows
[
0
][
'val_str'
],
};
}
return
null
;
}
/// Set value to Database
Future
<
void
>
insert
({
required
int
valueInt
,
required
double
valueDouble
,
required
String
valueString
,
})
async
{
await
_db
?.
transaction
((
txn
)
async
{
await
txn
.
rawInsert
(
'INSERT INTO
$table
(val_int, val_double, val_str) VALUES(?, ?, ?)'
,
[
valueInt
,
valueDouble
,
valueString
],
);
});
// After insert sqflite not empty
_streamController
!.
add
(
false
);
}
/// Update values to Database
Future
<
bool
>
update
({
required
int
id
,
required
int
valueInt
,
required
double
valueDouble
,
required
String
valueString
,
})
async
{
try
{
await
_db
?.
transaction
((
txn
)
async
{
final
result
=
await
txn
.
rawUpdate
(
'UPDATE
$table
SET val_int = ?, val_double = ?, val_str = ? WHERE rowid = ?'
,
[
valueInt
,
valueDouble
,
valueString
,
id
],
);
if
(
result
==
0
)
{
throw
Exception
(
'Nothing to update'
);
}
});
// After insert sqflite not empty
_streamController
!.
add
(
false
);
// Update success
return
true
;
}
catch
(
e
)
{
// Id not found
return
false
;
}
}
/// Clear all data table
Future
<
void
>
clear
()
async
{
await
_db
?.
rawDelete
(
'DELETE FROM
$table
'
);
// After clear date sqflite is empty
_streamController
!.
add
(
true
);
}
}
sqlite3_flutter_libs/example/lib/plugin_impl.dart
удалено
100644 → 0
Просмотр файла @
9c1945e0
// SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import
'dart:async'
;
import
'package:path/path.dart'
as
p
;
import
'package:sqflite_common_ffi/sqflite_ffi.dart'
;
/// Keys form demo
enum
ValueKeys
{
id
,
int
,
double
,
string
}
/// Table name
const
table
=
'Test'
;
/// Main features of the plugin sqflite
class
PluginImpl
{
/// Get instance Database
Database
?
_db
;
/// Stream for update values sqflite
/// from form
StreamController
<
bool
>
?
_streamController
;
/// Check save data to Database
Stream
<
bool
>
isEmptyStream
()
{
_streamController
??=
StreamController
<
bool
>(
onListen:
()
async
{
// Init db
await
init
();
// Check is empty
_streamController
!.
add
(
await
isEmpty
());
},
onCancel:
()
async
{
// Close db
await
close
();
});
return
_streamController
!.
stream
;
}
/// Check is table not empty
Future
<
bool
>
isEmpty
()
async
{
final
rows
=
await
_db
?.
rawQuery
(
'SELECT COUNT(rowid) as count FROM
$table
'
,
);
if
(
rows
!=
null
&&
rows
.
isNotEmpty
&&
rows
[
0
]
.
containsKey
(
'count'
))
{
return
rows
[
0
][
'count'
]
==
0
;
}
return
true
;
}
/// Init database
Future
<
void
>
init
()
async
{
// set up databaseFactory by databaseFactoryFfi for sqflite_common_ffi
databaseFactory
=
databaseFactoryFfi
;
// Get a location using getDatabasesPath
var
databasesPath
=
await
getDatabasesPath
();
String
path
=
p
.
join
(
databasesPath
,
'demo.db'
);
// Open the database
_db
=
await
openDatabase
(
path
,
version:
1
,
onCreate:
(
Database
db
,
int
version
)
async
{
// When creating the db, create the table
await
db
.
execute
(
'''CREATE TABLE
$table
(
val_int INTEGER,
val_double REAL,
val_str TEXT
) STRICT'''
);
// STRICT able only for libsqlite version >= 3.37
},
);
}
/// Close database
Future
<
void
>
close
()
async
{
await
_db
?.
close
();
}
/// Get value from Database
Future
<
Map
<
ValueKeys
,
dynamic
>
?
>
getValues
()
async
{
final
rows
=
await
_db
?.
rawQuery
(
'SELECT rowid as id, * FROM
$table
'
);
if
(
rows
!=
null
&&
rows
.
isNotEmpty
&&
rows
[
0
]
.
containsKey
(
'id'
))
{
return
{
ValueKeys
.
id
:
rows
[
0
][
'id'
],
ValueKeys
.
int
:
rows
[
0
][
'val_int'
],
ValueKeys
.
double
:
rows
[
0
][
'val_double'
],
ValueKeys
.
string
:
rows
[
0
][
'val_str'
],
};
}
return
null
;
}
/// Set value to Database
Future
<
void
>
insert
({
required
int
valueInt
,
required
double
valueDouble
,
required
String
valueString
,
})
async
{
await
_db
?.
transaction
((
txn
)
async
{
await
txn
.
rawInsert
(
'INSERT INTO
$table
(val_int, val_double, val_str) VALUES(?, ?, ?)'
,
[
valueInt
,
valueDouble
,
valueString
],
);
});
// After insert sqflite not empty
_streamController
!.
add
(
false
);
}
/// Update values to Database
Future
<
bool
>
update
({
required
int
id
,
required
int
valueInt
,
required
double
valueDouble
,
required
String
valueString
,
})
async
{
try
{
await
_db
?.
transaction
((
txn
)
async
{
final
result
=
await
txn
.
rawUpdate
(
'UPDATE
$table
SET val_int = ?, val_double = ?, val_str = ? WHERE rowid = ?'
,
[
valueInt
,
valueDouble
,
valueString
,
id
],
);
if
(
result
==
0
)
{
throw
Exception
(
'Nothing to update'
);
}
});
// After insert sqflite not empty
_streamController
!.
add
(
false
);
// Update success
return
true
;
}
catch
(
e
)
{
// Id not found
return
false
;
}
}
/// Clear all data table
Future
<
void
>
clear
()
async
{
await
_db
?.
rawDelete
(
'DELETE FROM
$table
'
);
// After clear date sqflite is empty
_streamController
!.
add
(
true
);
}
}
sqlite3_flutter_libs/example/pubspec.lock
0 → 100644
Просмотр файла @
d6c70e11
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
characters:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
clock:
dependency: transitive
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.18.0"
cupertino_icons:
dependency: transitive
description:
name: cupertino_icons
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
url: "https://pub.dev"
source: hosted
version: "1.0.8"
ffi:
dependency: transitive
description:
name: ffi
sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
flutter_localizations:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
internal_aurora:
dependency: "direct main"
description:
path: "."
ref: "aurora-0.5.3"
resolved-ref: "3f431b4d45049e5a60254fa566ce3181847c2dfe"
url: "https://gitlab.com/omprussia/flutter/flutter-community-plugins/internal_aurora.git"
source: git
version: "0.5.3"
intl:
dependency: transitive
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.19.0"
lints:
dependency: transitive
description:
name: lints
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
version: "1.15.0"
path:
dependency: "direct main"
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
sha256: "4468b24876d673418a7b7147e5a08a715b4998a7ae69227acafaab762e0e5490"
url: "https://pub.dev"
source: hosted
version: "2.5.4+5"
sqflite_common_ffi:
dependency: "direct main"
description:
name: sqflite_common_ffi
sha256: a6057d4c87e9260ba1ec436ebac24760a110589b9c0a859e128842eb69a7ef04
url: "https://pub.dev"
source: hosted
version: "2.3.3+1"
sqlite3:
dependency: transitive
description:
name: sqlite3
sha256: "45f168ae2213201b54e09429ed0c593dc2c88c924a1488d6f9c523a255d567cb"
url: "https://pub.dev"
source: hosted
version: "2.4.6"
sqlite3_flutter_libs:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.5.26"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225"
url: "https://pub.dev"
source: hosted
version: "3.3.0+3"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
web:
dependency: transitive
description:
name: web
sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
url: "https://pub.dev"
source: hosted
version: "1.1.0"
sdks:
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.0.0"
sqlite3_flutter_libs/example/pubspec.yaml
Просмотр файла @
d6c70e11
...
@@ -13,9 +13,9 @@ dependencies:
...
@@ -13,9 +13,9 @@ dependencies:
flutter
:
flutter
:
sdk
:
flutter
sdk
:
flutter
internal_aurora
:
internal_aurora
:
git
:
git
:
url
:
https://gitlab.com/omprussia/flutter/flutter-community-plugins/internal_aurora.git
url
:
https://gitlab.com/omprussia/flutter/flutter-community-plugins/internal_aurora.git
ref
:
0.5.
1
ref
:
aurora-
0.5.
3
sqflite_common_ffi
:
^2.0.0
sqflite_common_ffi
:
^2.0.0
path
:
^1.8.3
path
:
^1.8.3
sqlite3_flutter_libs
:
sqlite3_flutter_libs
:
...
...
sqlite3_flutter_libs/pubspec.yaml
Просмотр файла @
d6c70e11
...
@@ -3,7 +3,11 @@
...
@@ -3,7 +3,11 @@
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: BSD-3-Clause
name
:
sqlite3_flutter_libs
name
:
sqlite3_flutter_libs
description
:
Flutter plugin to include native sqlite3 libraries with your app
description
:
Flutter plugin to include native sqlite3 libraries with your app
version
:
0.5.25
version
:
0.5.26
repository
:
https://gitlab.com/omprussia/flutter/flutter-community-plugins/sqlite3.dart
publish_to
:
'
none'
homepage
:
https://github.com/simolus3/sqlite3.dart/tree/main/sqlite3_flutter_libs
homepage
:
https://github.com/simolus3/sqlite3.dart/tree/main/sqlite3_flutter_libs
issue_tracker
:
https://github.com/simolus3/sqlite3.dart/issues
issue_tracker
:
https://github.com/simolus3/sqlite3.dart/issues
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать