fromPath static method

Load a WordPiece tokenizer from a HuggingFace tokenizer.json at path.

path must be an ABSOLUTE filesystem path — not a Flutter asset key (File knows nothing about AssetBundle) and not a bundle-relative name. Under the macOS/iOS App Sandbox a path outside the app container needs an active security-scoped bookmark, or the read fails with a permission error for a file the user can see in Finder.

Native only — on web this throws UnsupportedError, because a browser has no on-disk path to read. Fetch the file yourself there and use fromJsonString.

Implementation

static Future<WordPieceEmbeddingTokenizer> fromPath(String path) async =>
    fromJsonString(await readTextFile(path));