This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class LocalStorage { | |
Future<LocalStorage> init(); | |
T? getData<T>(String key); | |
Future<bool> setData<T>(String key, T value); | |
bool hasData(String key); | |
Future<bool> removeData(String key); | |
Future<bool> clearStorage(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:artigo_sat/app/modules/configuracao/configuracao_bindings.dart'; | |
import 'package:artigo_sat/app/modules/configuracao/configuracao_page.dart'; | |
import 'package:get/get_navigation/src/routes/get_route.dart'; | |
class ConfiguracaoRoute { | |
ConfiguracaoRoute._(); | |
static final routes = [ | |
GetPage( | |
name: '/configuracao', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
import './home_controller.dart'; | |
class HomePage extends GetView<HomeController> { | |
const HomePage({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:artigo_sat/app/modules/configuracao/configuracao_bindings.dart'; | |
import 'package:artigo_sat/app/modules/configuracao/configuracao_page.dart'; | |
import 'package:get/get_navigation/src/routes/get_route.dart'; | |
class ConfiguracaoRoute { | |
ConfiguracaoRoute._(); | |
static final routes = [ | |
GetPage( | |
name: '/configuracao', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:artigo_sat/app/core/local_storage/local_storage.dart'; | |
import 'package:artigo_sat/app/core/local_storage/local_storage_impl.dart'; | |
import 'package:get/get.dart'; | |
class AppBinding implements Bindings { | |
@override | |
void dependencies() { | |
Get.putAsync<LocalStorage>(() => LocalStorageImpl().init(), permanent: true); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:shared_preferences/shared_preferences.dart'; | |
import './local_storage.dart'; | |
class LocalStorageImpl implements LocalStorage { | |
late SharedPreferences instance; | |
@override | |
Future<bool> clearStorage() async { | |
return await instance.clear(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class LocalStorage { | |
Future<LocalStorage> init(); | |
T getData<T>(String key); | |
Future<bool> setData<T>(String key, T value); | |
bool hasData(String key); | |
Future<bool> removeData(String key); | |
Future<bool> clearStorage(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class LocalStorage { | |
Future<LocalStorage> init(); | |
T getData<T>(String key); | |
Future<void> setData<T>(String key, T value); | |
bool hasData(String key); | |
Future<void> removeData(String key); | |
Future<void> clearStorage(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class LocalStorage { | |
Future<LocalStorage> init(); | |
T getData<T>(String key); | |
Future<void> setData<T>(String key, T value); | |
Future<bool> hasData(String key); | |
Future<void> removeData(String key); | |
Future<void> clearStorage(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './local_storage.dart'; | |
class LocalStorageImpl implements LocalStorage { | |
@override | |
Future<void> clearStorage() { | |
// TODO: implement clearStorage | |
throw UnimplementedError(); | |
} | |
@override |