Skip to content

Commit

Permalink
City locator works
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinmay-KB committed Apr 29, 2020
1 parent 4d907e8 commit 13b7d38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion gogrocy/lib/core/services/api.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:gogrocy/core/models/Address.dart' as address;
import 'package:gogrocy/core/models/Address.dart';
import 'package:gogrocy/core/models/Orders.dart';
import 'package:gogrocy/core/models/ProductsByCity.dart';
Expand Down
11 changes: 7 additions & 4 deletions gogrocy/lib/core/services/shared_prefs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ class SharedPrefsService {
final SharedPreferences prefs = await SharedPreferences.getInstance();
String city=prefs.getString("city");
if(city==null){
List<Address> address=await apis.getAddresses();
setCity(address[0].city);
return address[0].city;
//List<Address> address=await apis.getAddresses();
//setCity(address[0].city);
return null;
}
else {
print(city);
return city;
}
else return city;
}

}

0 comments on commit 13b7d38

Please sign in to comment.