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
class ApiBaseHelper { | |
final String baseUrl; | |
final PreferenceManager preferenceManager; | |
ApiBaseHelper({ | |
required this.baseUrl, | |
required this.preferenceManager, | |
}); | |
Future<Dio> _getInstance() async { |
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
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( |
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
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(); |