getAppRootPath method
Returns the root directory path of the app.
This method retrieves the root directory where the app has access to store or retrieve files.
Platform-specific behavior:
- On Android
storage/emulated/0/Android/data/com.example.myapp/files
- On Linux
Directory.current.path
Returns:
- A
Future<String?>
resolving to the root path of the app. - Throws an
UnimplementedError
if the method is not implemented.
Example:
String? path = await getAppRootPath();
if (path != null) {
print("App root path: $path");
}
Implementation
@override
Future<String> getAppRootPath() async {
return await ThanPkg.android.app.getExternalFilesDir();
}