Storage getItem method
Stay organized with collections
Save and categorize content based on your preferences.
getItem(
key: string
): string | null;
Returns the current value associated with the given key, or null if the given
key does not exist.
Examples
let starsEarned = Number(GameSnacks.storage.getItem('starsEarned'));
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-03 UTC."],[[["\u003cp\u003e\u003ccode\u003egetItem()\u003c/code\u003e retrieves the value stored for a specific key within the GameSnacks storage.\u003c/p\u003e\n"],["\u003cp\u003eIf the specified key is not found, \u003ccode\u003egetItem()\u003c/code\u003e returns \u003ccode\u003enull\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe retrieved value is a string and might require type conversion for numerical or boolean values.\u003c/p\u003e\n"]]],[],null,["# Storage getItem method\n\n getItem(\n key: string\n ): string | null;\n\nReturns the current value associated with the given key, or null if the given\nkey does not exist.\n\nExamples\n--------\n\n let starsEarned = Number(GameSnacks.storage.getItem('starsEarned'));"]]