sa_app_storage_lego
app storage lego under simple architecture framework.
Installation
- open terminal in the lego project root directory, enter the following command for install cli. and create a new lego project if you don't have one.
flutter pub global activate lego_cli
lego create
- in terminal, enter the following command for add lego to project.
lego add sa_app_storage_lego
Usage
using string.
String textToSave = "Hello, Dart!";
File savedFile = await CheckAppStorage.setByString(textToSave);
print("File saved at: ${savedFile.path}");
File? retrievedFile = await CheckAppStorage.get();
if (retrievedFile != null) {
String retrievedText = await retrievedFile.readAsString();
print("Retrieved text: $retrievedText");
if (textToSave == retrievedText) {
print("The text matches!");
} else {
print("The text does not match.");
}
} else {
print("No file found.");
}
using data.
Uint8List dataToSave = Uint8List.fromList([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
File savedFile = await CheckAppStorage.setByData(dataToSave);
print("File saved at: ${savedFile.path}");
File? retrievedFile = await CheckAppStorage.get();
if (retrievedFile != null) {
Uint8List retrievedData = await retrievedFile.readAsBytes();
print("Retrieved data: $retrievedData");
if (dataToSave.length == retrievedData.length &&
dataToSave.every((byte) => retrievedData.contains(byte))) {
print("The data matches!");
} else {
print("The data does not match.");
}
} else {
print("No file found.");
}
using string with id.
String fileId = "testFile";
// 저장할 문자열
String textToSave = "Hello, Dart!";
// 문자열을 파일에 저장
File savedFile = await Check2AppStorage.setByString(fileId, textToSave);
print("File saved at: ${savedFile.path}");
// 파일에서 문자열 읽기
File? retrievedFile = await Check2AppStorage.get(fileId);
if (retrievedFile != null) {
String retrievedText = await retrievedFile.readAsString();
print("Retrieved text: $retrievedText");
// 문자열이 동일한지 확인
if (textToSave == retrievedText) {
print("The text matches!");
} else {
print("The text does not match.");
}
} else {
print("No file found.");
}
using data with id.
String fileId = "testFile";
Uint8List dataToSave = Uint8List.fromList([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
File savedFile = await Check2AppStorage.setByData(fileId, dataToSave);
print("File saved at: ${savedFile.path}");
File? retrievedFile = await Check2AppStorage.get(fileId);
if (retrievedFile != null) {
Uint8List retrievedData = await retrievedFile.readAsBytes();
print("Retrieved data: $retrievedData");
bool dataMatches = dataToSave.length == retrievedData.length &&
dataToSave.every((byte) => retrievedData.contains(byte));
if (dataMatches) {
print("The data matches!");
} else {
print("The data does not match.");
}
} else {
print("No file found.");
}
Libraries
- app/backend/app_storage.with_id/_new
- app/backend/app_storage/_new
- app/backend/app_storage_example.with_id/_new
- app/backend/app_storage_example.with_id/check2
- app/backend/app_storage_example/_new
- app/backend/app_storage_example/check
- app/backend/data_class/_new
- main
- note/note
- note/note_view
- util/_/build_app/function/before_material_app/_
- util/_/build_app/function/before_material_app/bot_toast_lego/_
- util/_/build_app/function/before_material_app/sa_app_storage_lego/_
- util/_/build_app/function/before_run_app/_
- util/_/build_app/function/before_run_app/sa_app_storage_lego/_
- util/_/build_app/function/before_run_app/widget_binding_lego/_
- util/_/build_app/widget/material_app/_
- util/_/build_app/widget/material_app/bot_toast_lego/_
- util/_/build_app/widget/material_app/sa_app_storage_lego/_
- util/_/build_app/widget/my_app/_
- util/_/build_app/widget/my_app/sa_app_storage_lego/_
- util/_/build_app/widget/run_app/_
- util/_/build_app/widget/run_app/sa_app_storage_lego/_
- util/_/build_app/widget/run_app/screenutil_lego/_
- util/_/module_functions/sa_app_storage_lego/_
- util/_/shared_params/_/material_app
- util/_/shared_params/_/start_app_params
- util/_/shared_params/bot_toast_lego/_
- util/_/shared_params/sa_app_storage_lego/_
- util/config/sa_app_storage_lego/_
- util/usage/sa_app_storage_lego/usage
- util/usage/sa_app_storage_lego/usage_view
- widget_book/sa_app_storage_lego.bottom_sheet/_/_
- widget_book/sa_app_storage_lego.bottom_sheet/bottom_sheet
- widget_book/sa_app_storage_lego.bottom_sheet/usage
- widget_book/sa_app_storage_lego.dialog/_/_
- widget_book/sa_app_storage_lego.dialog/dialog
- widget_book/sa_app_storage_lego.dialog/usage
- widget_book/sa_app_storage_lego.in_app_notification/_/_
- widget_book/sa_app_storage_lego.in_app_notification/in_app_notification
- widget_book/sa_app_storage_lego.in_app_notification/usage
- widget_book/sa_app_storage_lego.snackbar/_/_
- widget_book/sa_app_storage_lego.snackbar/snackbar
- widget_book/sa_app_storage_lego.snackbar/usage
- widget_book/sa_app_storage_lego.toast/_/_
- widget_book/sa_app_storage_lego.toast/toast
- widget_book/sa_app_storage_lego.toast/usage
- widget_book/sa_app_storage_lego/_/_