Skip to content

Instantly share code, notes, and snippets.

View KingsleyUsoroeno's full-sized avatar
🎯
Focusing

Kingsley Usoro KingsleyUsoroeno

🎯
Focusing
View GitHub Profile
class ApiBaseHelper {
final String baseUrl;
final PreferenceManager preferenceManager;
ApiBaseHelper({
required this.baseUrl,
required this.preferenceManager,
});
Future<Dio> _getInstance() async {
Future<Dio> getInstance() async {
final String token =
await fluxPreference.readString(PreferenceConstants.USER_TOKEN, null);
Map<String, dynamic> headers = {};
headers['Content-Type'] = 'application/json';
headers['RESPONSE-VERSION'] = '2';
if (token != null) headers['Authorization'] = 'Bearer $token';
print("Token ============================ $token");
return Dio(BaseOptions(
@KingsleyUsoroeno
KingsleyUsoroeno / numberSwap
Created May 29, 2020 20:40
A function that requires a two digit and determines if its the largest of two possible number swaps
private static boolean numberSwap(int number) {
try {
// first know if the number parse in is of two length
String s = String.valueOf(number);
if (s.length() < 2) {
System.out.println("number has to be of two length");
return false;
}
// reverse the number
String reservedNumber = new StringBuilder(String.valueOf(number)).reverse().toString();