syncUser method
Implementation
Future<Map<String,dynamic>> syncUser({Map<String,dynamic>?include=const{},bool dispatch=true}) async {
var res = {};
try{
final prefs = StorageProvider();
if(dotenv.env['authUserInclude'] != null && (include == null || include.isEmpty)){
include = Map.from(include ?? {});
List<String> str = dotenv.env['authUserInclude']!.split(',');
for (var item in str) { if (item.isNotEmpty) { include[item.trim()] = true; } }
}
var path = getQueryPathByScope("users/auth/profile");
res = await get(path,include:include);
if(res['data'] != null){
prefs.setObject("user",res['data']);
if(dispatch){ subUser.sink.add(res['data']); }
}
} on QueryException catch (err){
return Future.error(err);
}
return res['data'];
}