Skip to content

Xapptor/xapptor_logic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xapptor Logic

pub package

Logic Module for util functions like cross-platform downloaders and functions to retrieve remote info.

Let's get started

1 - Depend on it

Add it to your package's pubspec.yaml file
dependencies:
    xapptor_logic: ^0.0.3

2 - Install it

Install packages from the command line
flutter pub get

3 - Learn it like a charm

File Downloader (Call Share in Mobile)

FileDownloader.save(
    base64_string: pdf_bytes,
    file_name: file_name,
);

Check if payments are enabled (Firestore)

Collection: metadata

Document: payments

Field: enabled

Check: for each platform inside "enabled" (android/ios/web)

bool payments_are_enabled = await check_if_payments_are_enabled();

Check if user is admin (Firestore)

Collection: users

Document: user_id

Field: admin

bool user_is_admin = await check_if_user_is_admin(user_id);

Firebase Tasks

CREATE

Coupons

Collection: coupons

create_coupons(times, base_id);

UPDATE

Field Value in Collection

update_field_value_in_collection(field, value, collection);

Field Name in Collection

update_field_name_in_collection(collection, old_field, new_field);

Field Name in Document

update_field_name_in_document(collection, document, document_id, old_field, new_field);

Item Value in Array

update_item_value_in_array(document_id, collection_id, field_key, field_value, index);

DUPLICATE

Document

duplicate_document(document_id, collection_id, times, base_id, apply_random_number);

Item in Array

duplicate_item_in_array(document_id, collection_id, field_key, index, times, callback);

DELETE

Field in Collection

delete_field_in_collection(field, collection);

Corrupted Accounts

Delete accounts that don't have gender, birthday, and country field

delete_corrupted_accounts();

Corrupted Certificates

Delete certificates that don't have a user_id registered

delete_corrupted_certificates();

CHECK

If coupon is valid

check_if_coupon_is_valid(
    coupon_id,
    context,
    valid_message,
    invalid_message,
);

Certificates

Get html certificate

get_html_certificate(
    course_name,
    user_name,
    date,
    id,
);

Check if exist certificate

check_if_exist_certificate(
    course_id,
    context,
    show_has_certificate,
);

Save certificate

save_certificate(
    user,
    user_info,
    course_id,
    has_certificate,
    show_has_certificate,
    context,
);

Check if course was completed

check_if_course_was_completed(
    course_id,
    user_info,
    context,
);

Get main color from image

get_main_color_from_image(image);

Get main color from remote image

get_main_color_from_remote_image(url);

Get main color from remote SVG

get_main_color_from_remote_svg(url);

Get remote image

get_remote_image(url);

Get remote SVG

get_remote_svg(url);

Check if is portrait mode

is_portrait(context);

Random number between a range

random_number_with_range(min, max);

Request position

request_position();

Get address from position

get_address_from_position();

Send Email

send_email(
    to,
    subject,
    text,
    html,
);

Convert timestamp to date

timestamp_to_date(time_stamp);

4 - Check Abeinstitute Repo for more examples

Abeinstitute Repo

Abeinstitute

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages