Skip to content

Commit

Permalink
adding folder name in order to create folders inside app storage in t…
Browse files Browse the repository at this point in the history
…he future
  • Loading branch information
sb-dor committed Aug 13, 2024
1 parent a22059b commit b2c5606
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/core/global_usages/constants/constants.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
abstract class Constants {
static const String appName = "Yahay";
// integers
static const int perPage = 30;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:path/path.dart' as path;
import 'package:yahay/core/global_usages/constants/constants.dart';

class ReusableGlobalFunctions {
final _videoExtensions = [
Expand Down Expand Up @@ -26,6 +27,14 @@ class ReusableGlobalFunctions {
'.heic'
];

final _foldersName = [
"${Constants.appName} Audio",
"${Constants.appName} Documents",
"${Constants.appName} Files",
"${Constants.appName} Images",
"${Constants.appName} Videos",
];

/// Removes duplicate elements from a list based on a custom test function.
///
/// This function iterates through the provided list and removes elements that
Expand Down
18 changes: 18 additions & 0 deletions lib/core/utils/folder_creator/folder_creator.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'dart:io';

class FolderCreator {
static FolderCreator? _instance;

static FolderCreator get instance => _instance ??= FolderCreator._();

FolderCreator._();

//
Future<void> creatorFolder({required String path}) async {
final directory = Directory(path);
if (directory.existsSync()) return;
directory.createSync();
}

// ----------------------------------------------
}

0 comments on commit b2c5606

Please sign in to comment.