sa_app_storage_lego

Creator: coderz1093

Last updated:

0 purchases

sa_app_storage_lego Image
sa_app_storage_lego Images
Add to Cart

Description:

sa app storage lego

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
copied to clipboard

in terminal, enter the following command for add lego to project.

lego add sa_app_storage_lego
copied to clipboard
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.");
}
copied to clipboard
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.");
}
copied to clipboard
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.");
}
copied to clipboard
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.");
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.

Related Products

More From This Creator