Skip to content

Instantly share code, notes, and snippets.

View 0xabdou's full-sized avatar
🏠
Working from home

abdou 0xabdou

🏠
Working from home
View GitHub Profile
void main() {
final d = DateTime.now();
final ms = d.millisecondsSinceEpoch;
final d1 = DateTime.fromMillisecondsSinceEpoch(ms);
print(d);
print(d1);
print(d1 == d);
}
{
"notification": {
"body": "this is a body",
"title": "this is a title",
"android_channel_id": "green_channel"
},
"priority": "high",
"data": {
"click_action": "FLUTTER_NOTIFICATION_CLICK"
{
"data": [
{
"id" : "s1fd89fh",
"name": "Bovin",
"iconUrl": "https://svgur.com/i/LCL.svg",
"varieties" : [
{"id" : "id1", "name": "genisse"},
{"id" : "id2", "name": "genisse pleine"},
{"id" : "id3", "name": "veau"},
final formDataMap = {
'photos': photos,
'type_id': creation.type.id,
'variety_id': creation.variety.id,
'destination_id': creation.destination.id,
'food_ids': creation.food.map((f) => f.id).toList(),
'locationLat': creation.location.latitude,
'locationLong': creation.location.longitude,
'areaNameAr': creation.location.localizedAreaName['ar'],
'areaNameFr': creation.location.localizedAreaName['fr'],
{
"data": [
{
"_id": "kind_1",
"name": "Olivier",
"varieties": [
{
"_id": "kind_1_variety_1",
"name": "Picholine marocaine"
},
{
"data": [
{
"_id": "category0",
"name": "Huile d'olive",
"types": [
{
"_id": "oil_category_0_type_0",
"name": "Huile d’olive vierge extra",
"acidity": "≤ 0,8 %",
final formDataMap = {
'photos': photos,
'category_id': creation.category.id,
'type_id': creation.type.id,
'quantity': creation.quantity,
'locationLat': creation.location.latitude,
'locationLong': creation.location.longitude,
'areaNameAr': creation.location.localizedAreaName['ar'],
'areaNameFr': creation.location.localizedAreaName['fr'],
'hideNumber': creation.phoneHidden,

Filters request params

page: int, used for pagination

orderBy: String, ["mostRecent", "rating", "priceAsc"]

if one of the next location params is not null, the rest is also not null:

  1. lon: double, longitude of listing location
  2. lat: double, latitude of listing location
  3. radius: int, radius from (lat, lon) point, return all listings inside it
void main() {
final json = <String, dynamic>{
'price1': 1,
'price2': 1.1,
};
final price1 = double.parse(json['price1'].toString());
final price2 = double.parse(json['price2'].toString());
print(price1);
print(price2);
}
@0xabdou
0xabdou / doc.txt
Last active September 24, 2020 12:10
NOTE: When creating a user, store only the jwt token, the phone number,
and facebook id if provided, the name and other user info are handled
in the next steps using already existing endpoints
NOTE: user info to be returned are: userId, phoneNumber, authToken
########### Endpoints with no authentication needed ##############
* loginWithFacebook: POST, params = {fbToken : String}
- Make a get request to facebook api with the token, and retrieve the facebook id