这是indexloc提供的服务,不要输入任何密码

sa_app_storage_lego 1.0.1 copy "sa_app_storage_lego: ^1.0.1" to clipboard
sa_app_storage_lego: ^1.0.1 copied to clipboard

app storage lego under simple architecture framework.

lego project pub package

sa_app_storage_lego #

app storage lego under simple architecture framework.

Installation #

  1. 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
  1. 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.");
  }
1
likes
110
points
40
downloads

Publisher

unverified uploader

Weekly Downloads

app storage lego under simple architecture framework.

Repository (GitHub)

Topics

#lego

Documentation

API reference

License

MIT (license)

Dependencies

bot_toast, flutter, flutter_screenutil, flutter_svg, flutter_zoom_drawer, gap, june_flow_util, keyboard_attachable, modal_bottom_sheet, path, path_provider, styled_widget

More

Packages that depend on sa_app_storage_lego