flutter-woocommerce-app/LabelStoreMax/lib/helpers/shared_pref/sp_user_id.dart

31 lines
845 B
Dart

// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import 'package:flutter/cupertino.dart';
import 'package:label_storemax/helpers/shared_pref.dart';
const keyUserId = "DEFAULT_SP_USERID";
storeUserId(String v) async {
SharedPref sharedPref = SharedPref();
await sharedPref.save(keyUserId, v);
}
Future<String> readUserId() async {
SharedPref sharedPref = SharedPref();
String val = await sharedPref.read(keyUserId);
return val;
}
destroyUserId(BuildContext context) async {
SharedPref sharedPref = SharedPref();
await sharedPref.save(keyUserId, null);
}