documentDirectory property

Future<String?> documentDirectory

Obtains the document path where the file can be placed by determining the platform.

Use getLibraryDirectory for iOS and getApplicationDocumentsDirectory for others.

Web returns Null.

ファイルを置けるドキュメントパスをプラットフォームを判別して取得します。

iOSgetLibraryDirectory、その他はgetApplicationDocumentsDirectoryを利用します。

WebNullを返します。

Implementation

static Future<String?> get documentDirectory async {
  if (Platform.isIOS) {
    return (await getLibraryDirectory()).path;
  } else {
    return (await getApplicationDocumentsDirectory()).path;
  }
}