easy_engine 0.0.2 copy "easy_engine: ^0.0.2" to clipboard
easy_engine: ^0.0.2 copied to clipboard

The counter part of the easy_engine project.

Easy Extensions #

This package is the counter part of the easy-engine of the firebase cloud functions project

ClaimAdmin #

The EngineService.instance.claimAdmin function allows the logged-in user to set himself as an admin. If an admin already exists, it will give an error(Exception) with the code already-exist and the message Admin already exists.

Essentially, it marks the admin field of the logged-in user as true if no other user has this field set to true.

  • region is the region of your cloud functions. It is recommended to have the same region as your firestore.
ElevatedButton(
  onPressed: () async {
    try {
      await engine.claimAdmin(region: region);
      onSuccess();
    } on FirebaseFunctionsException catch (e) {
      onFailure('${e.code}/${e.message}');
    } catch (e) {
      onFailure(e.toString());
    }
  },
  child: const Text('Claim Admin'),
)

ClaimAdminButton #

  • Use the ClaimAdminButton widget for simplicity, or copy its code to customize it yourself.
ClaimAdminButton(region: 'asia-northeast3'),
1
likes
0
points
330
downloads

Publisher

verified publishersonub.com

Weekly Downloads

The counter part of the easy_engine project.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cloud_functions, firebase_auth, flutter

More

Packages that depend on easy_engine