FileOperationService class
Service for handling file operations in Json2Dart generation
This service provides centralized file management including reading JSON files, writing generated code, and managing file cleanup operations.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
appendToFile(
String filePath, String content) → void - Appends content to an existing file
-
createInitialStructure(
) → void - Creates the initial project structure for Json2Dart
-
ensureDirectoryExists(
String path) → void - Creates directory structure if it doesn't exist
-
fileExists(
String path) → bool - Checks if a file exists
-
findFiles(
String searchPattern, String searchDirectory) → List< String> - Gets file paths for a specific search pattern
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readFileContent(
String filePath) → String - Reads file content safely
-
readJsonFile(
String? path, {required void onJsonIsList(), String warningMessage = 'Format json not valid!'}) → dynamic - Reads and parses JSON from a file path
-
removeAllRelatedApiFiles(
String pathPage, String pageName, Map< String, dynamic> pageValue, bool isReplace) → void - Removes all related API files for a page
-
removeAllRelatedUnitTestFiles(
String featureName, String pageName) → void - Removes all related unit test files for a page
-
removeDirectory(
String path) → void - Removes a directory if it exists
-
removeFile(
String path) → void - Removes a file if it exists
-
toString(
) → String -
A string representation of this object.
inherited
-
writeFileContent(
String filePath, String content) → bool - Writes content to a file with error handling
-
writeGeneratedFile(
String path, String fileName, String content) → void - Writes generated code to a file
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited