createInFolder static method
Open or create a bookmarks collection with the provided name and folder path.
The factory creates or opens the underlying bookmarks database for the given name and folderPath
and returns a RouteBookmarks instance that operates on that collection.
Parameters
name: The name (path) of the bookmarks collection to open or create.folderPath: Optional folder absolute path where the bookmarks collection file is stored. Folder needs to exist in the app root directory before calling this method.
Returns
RouteBookmarks?: the created RouteBookmarks instance on success, ornullif creation failed (invalid folder path or lack of write permissions).
Implementation
static RouteBookmarks? createInFolder({
required final String name,
final String folderPath = '',
}) {
final String encodedVal = jsonEncode(<String, dynamic>{
'class': 'RouteBookmarks',
'args': <String, dynamic>{'name': name, 'folderPath': folderPath},
});
final String resultString = GemKitPlatform.instance.callCreateObject(
encodedVal,
);
final dynamic decodedVal = jsonDecode(resultString);
if (decodedVal['gemApiError'] != 0) {
return null;
}
return RouteBookmarks.init(decodedVal['result']);
}