# Pamięć lokalna (Flutter) > SharedPreferences, flutter_secure_storage, path_provider, pliki, najlepsze praktyki bezpieczeństwa - 20 pytań z rozmów - Junior - [Pytania z rozmów: Flutter](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne.md) ## 1. Którego pakietu należy użyć do trwałego przechowywania prostych par klucz-wartość w aplikacji Flutter? **Odpowiedź** SharedPreferences to standardowy pakiet do trwałego przechowywania prostych danych typu klucz-wartość we Flutterze. Wykorzystuje NSUserDefaults na iOS i SharedPreferences na Androidzie. Pakiet ten jest idealny dla preferencji użytkownika, ustawień aplikacji lub niewielkich ilości danych niewrażliwych. ## 2. Jak uzyskać instancję SharedPreferences we Flutterze? **Odpowiedź** SharedPreferences.getInstance() zwraca Future, który rozwiązuje się do pojedynczej instancji SharedPreferences. Ta asynchroniczna metoda ładuje preferencje z natywnej pamięci. Zaleca się wywołanie tej metody tylko raz i ponowne użycie instancji, aby uniknąć wielokrotnego ładowania. ## 3. Jakie typy danych można przechowywać za pomocą SharedPreferences? **Odpowiedź** SharedPreferences obsługuje tylko typy proste: int, double, bool, String i List. Aby przechowywać złożone obiekty, należy je zserializować do JSON String, a następnie zdeserializować podczas odczytu. To ograniczenie wynika z bazowej natywnej implementacji na iOS i Androidzie. ## Jeszcze 17 dostępnych pytań - Której metody należy użyć do zapisania wartości logicznej za pomocą SharedPreferences? - Co zwraca prefs.getString('key'), jeśli klucz nie istnieje w SharedPreferences? Zarejestruj się za darmo: https://sharpskill.dev/pl/login ## Inne tematy rekrutacyjne Flutter - [Podstawy Dart](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/dart-basics.md): 25 pytań, Junior - [Podstawy języka Dart](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/dart-language-essentials.md): 15 pytań, Junior - [Podstawy Flutter](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/flutter-fundamentals.md): 18 pytań, Junior - [Cykl życia widżetów](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/widget-lifecycle.md): 20 pytań, Junior - [Cykl życia aplikacji](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/app-lifecycle.md): 20 pytań, Junior - [Layouts & Constraints](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/layouts-constraints.md): 24 pytań, Mid-Level - [ListView & GridView](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/listview-gridview.md): 25 pytań, Mid-Level - [Nawigacja i routing](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/navigation-routing.md): 22 pytań, Mid-Level - [Podstawowe zarządzanie stanem](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/state-management-basics.md): 22 pytań, Mid-Level - [Provider Pattern](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/provider-pattern.md): 18 pytań, Mid-Level - [Networking & HTTP](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/networking-http.md): 20 pytań, Mid-Level - [Serializacja JSON](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/json-serialization.md): 20 pytań, Mid-Level - [Lokalna baza danych](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/local-database.md): 22 pytań, Mid-Level - [Formularze i walidacja](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/forms-validation.md): 20 pytań, Mid-Level - [Animacje](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/animations.md): 20 pytań, Mid-Level - [Integracja Firebase](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/firebase-integration.md): 18 pytań, Mid-Level - [Testy jednostkowe](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/unit-testing.md): 20 pytań, Mid-Level - [Testy widgetów](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/widget-testing.md): 18 pytań, Mid-Level - [Build i wdrażanie](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/build-deployment.md): 16 pytań, Mid-Level - [Zarządzanie pakietami](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/package-management.md): 16 pytań, Mid-Level - [Pamięć i wydajność](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/memory-performance.md): 22 pytań, Senior - [Streams & RxDart](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/streams-rxdart.md): 24 pytań, Senior - [Zaawansowane State Management](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/advanced-state-management.md): 26 pytań, Senior - [Flutter Design Patterns](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/flutter-design-patterns.md): 24 pytań, Senior - [Optymalizacja wydajności](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/performance-optimization.md): 26 pytań, Senior - [Platform Channels](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/platform-channels.md): 20 pytań, Senior - [Custom Painting](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/custom-painting.md): 22 pytań, Senior - [Architektura aplikacji Flutter](https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/flutter-app-architecture.md): 22 pytań, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/pl/technologies/flutter/pytania-rekrutacyjne/local-storage