fixed lookup references

main
Zachary Atkins 3 years ago
parent ad62f5f1b0
commit dceeb18513

@ -7,7 +7,7 @@ void main() async {
runApp(App());
final prefs = await SharedPreferences.getInstance();
final userName = prefs.getString('userName') ?? '0';
if (id == '0') {
if (userName == '0') {
prefs.setString('id', Random().nextInt(10000).toString());
}
}

@ -9,13 +9,14 @@ import 'dart:io';
class Transaction {
Transaction({required this.hash}) {
SharedPreferences.getInstance().then((s) => _id = s.getString('id') ?? '0');
SharedPreferences.getInstance()
.then((s) => _id = s.getString('userName') ?? '0');
}
late final String _id;
final String hash;
static Future<String> makeTransactionHash(String otherUserId) async {
static Future<String> signTransaction(String otherUserId) async {
String id = await SharedPreferences.getInstance()
.then((s) => s.getString('id') ?? '');
.then((s) => s.getString('userName') ?? '');
bool idLess = id.compareTo(otherUserId) < 0;
var lesser = idLess ? id : otherUserId;
var greater = idLess ? otherUserId : id;

Loading…
Cancel
Save