loadFromPackage static method

Future<String> loadFromPackage({
  1. required String packageName,
  2. required String filePath,
})

Loads a string from a file within a package

Parameters:

  • packageName: Name of the package (e.g., 'gtd_utils')
  • filePath: Path to the file within the package (e.g., 'lib/data/resource/file.txt')

Returns a Future

Implementation

static Future<String> loadFromPackage({
  required String packageName,
  required String filePath,
}) {
  final fullPath = 'packages/$packageName/$filePath';
  return rootBundle.loadString(fullPath);
}