handleSignFacebook method

Future<String?> handleSignFacebook(
  1. BuildContext context, {
  2. Widget? page,
  3. Position? position,
})

Implementation

Future<String?> handleSignFacebook(BuildContext context,
    {Widget? page, Position? position}) async {
  ApiSellon.createDefaultParams((parameter) {
    ApiSellon api = ApiSellon(context);
    api.execute(
        MethodsSellon.pelangganCheckVersionApp, SellonMethod.post, parameter,
            (response) async {
          if (response
              .data()['data']['facebook_login']
              .toString()
              .toLowerCase() == "on") {
            await signInWithFacebook(context, page: page, position: position);
          } else {
            Helper().showDialogBox(
                context,
                Icons.error_outline_rounded,
                "Sorry!",
                "Facebook Login is currently not available, please try another method",
                backOrOkey: () {
                  SellonRouter.pop(context);
                });
          }
        });
  });
}