✨Works out of the box. If you face any issue at all, hit us up here and we will write the integration for you.

Flutter
Quickstart

Installation

Dart Installation

Run the following command in your terminal:

dart pub add reclaim_flutter

Flutter Installation

Alternatively, you can use Flutter to install the package:

flutter pub add reclaim_flutter

Running these command will update your pubspec.yaml:

dependencies:
  reclaim_flutter: any

After successful installation, you can import the package in your Dart code:

import 'package:reclaim_flutter/reclaim_flutter.dart';

Usage

Once the package is installed, you can start using ReclaimHttps and ReclaimSwiggy in your application.

Https Implementation

import 'package:flutter/material.dart';
import 'package:reclaim_flutter/reclaim_flutter.dart';
 
void main() {
  runApp(const MainApp());
}
 
// Init a GlobalKey and pass it to ReclaimHttps widget
final httpEqualKey = GlobalKey<ReclaimHttpsState>();
 
class MainApp extends StatelessWidget {
  const MainApp({super.key});
 
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: ListView.builder(
          itemCount: 1,
          itemBuilder: (BuildContext context, int index) {
            return Center(
              child: ReclaimHttps(
                key: httpEqualKey,
                requestedProofs: [
                  RequestedProof(
                    url: 'https://bookface.ycombinator.com/home',
                    loginUrl: 'https://bookface.ycombinator.com/home',
                    loginCookies: ['_sso.key'],
                    responseSelections: [
                      ResponseSelection(
                        responseMatch: '{&quot;id&quot;:{{YC_USER_ID}},.*?waas_admin.*?:{.*?}.*?:\\{.*?}.*?(?:full_name|first_name).*?}',
                      ),
                    ],
                  ),
                ],
                title: "YC Login",
                subTitle: "Prove you have a YC Login",
                cta: "Prove",
                onStatusChange: (status) =>
                  print('Status changed to : $status'),
                onSuccess: (proofs) {
                  print('proofs: $proofs');
                },
                onFail: (Exception e) {
                  print('Error: $e');
                },
                showShell: true,
                shellStyles: BoxDecoration(
                  border: Border.all(color: Colors.red, width: 2.0),
                ),
              ),
            );
          },
        ),
      ),
    );
  }
}

In order to trigger the claim creation without showing the shell, run the following:

httpEqualKey.currentState?.triggerOpenWebView();

onSuccess Callback

proofs: 
{
  "identifier": "0x77ddebedb5..",
  "claimData": {
    "provider": "http",
    "parameters": {
      "method": "GET",
      "responseSelections": [
        {
          "responseMatch": "{&quot;id&quot;:182853,.*?waas_admin.*?:{.*?}.*?:\\{.*?}.*?(?:full_name|first_name).*?}"
        }
      ],
      "url": "https://bookface.ycombinator.com/home"
    },
    "owner": "0x322b8f7573..",
    "timestampS": 1695149749,
    "context": "YC Alumni",
    "identifier": "0x77ddebedb50..",
    "epoch": 2
  },
  "signatures": [
    "0xaf5c8dfdd.."
  ],
  "witnessHosts": [
    "https://reclaim-node.questbook.app"
  ]
}

onFail Callback

Error: An Error occured while creating claim

Swiggy Implementation

import 'package:flutter/material.dart';
import 'package:reclaim_flutter/reclaim_flutter.dart';
void main() {
  runApp(const MainApp());
}
 
// Init a GlobalKey and pass it to ReclaimSwiggy widget
final swiggyKey = GlobalKey<ReclaimSwiggyState>();
 
class MainApp extends StatelessWidget {
  const MainApp({super.key});
 
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: ListView.builder(
          itemCount: 1,
          itemBuilder: (BuildContext context, int index) {
            return Center(
              child: Column(
                children: [
                  ReclaimSwiggy(
                    key: swiggyKey,
                    requestedProofs: [
                      SwiggyRequestedProof(
                        url: 'https://www.swiggy.com/dapi/order/all?order_id=',
                        loginUrl: 'https://www.swiggy.com/auth',
                        loginCookies: ['_session_tid'],
                      ),
                    ],
                    title: "Swiggy",
                    subTitle: "Prove that you are a swiggy user",
                    cta: "Prove",
                    onClaimStateChange: (claimState) {
                      // claimState can be 'initiating', 'creating', 'done'
                      // Hide ReclaimSwiggy Widget on claimState === 'initiating' and show fetching animation
                      print(claimState);
                    },
                    onSuccess: (proofs) {
											// proofs contains a list of proof
                      print('proofs: $proofs');
                      // Show a success modal or bottom sheet
                    },
                    onFail: (Exception e) {
                      print('Error: $e');
                    },
                  ),
                  SizedBox(height: 20),
                  ElevatedButton(
                    child: Text('Custom Trigger'),
                    onPressed: () {
											//The trigger can be called from anywhere
                      swiggyKey.currentState?.triggerOpenWebView();
                    },
                  ),
                ],
              ),
            );
          },
        ),
      ),
    );
  }
}

onSuccess Callback

proofs: 
{
  "identifier": "0x0085d4c..",
  "claimData": {
    "provider": "swiggy-equal",
    "parameters": {
      "userData": {
        "statusCode": "STATUS_CODE",
        "data": {
          "total_orders": "TOTAL_ORDERS",
          "customer_care_number": "CUSTOMER_CARE_NUMBER",
          "orders": [
            {
              "sharedOrder": "SHARED_ORDER",
              "previousOrderId": "PREVIOUS_ORDER_ID",
              "tipDetails": {
                "amount": "AMOUNT",
                "optIn": "OPT_IN",
                "type": "TYPE"
              },
              "deliveryFeeCouponBreakup": {
                "thresholdFee": "THRESHOLD_FEE",
                "distanceFee": "DISTANCE_FEE",
                "timeFee": "TIME_FEE",
                "specialFee": "SPECIAL_FEE",
                "totalDeliveryFeeDiscount": "TOTAL_DELIVERY_FEE_DISCOUNT",
                "discountShare": {
                  "swiggyDiscount": "SWIGGY_DISCOUNT",
                  "restaurantDiscount": "RESTAURANT_DISCOUNT"
                }
              },
              "order_id": "ORDER_ID",
              "delivery_address": {
                "id": "ID",
                "version": "VERSION",
                "name": "NAME",
                "address_line1": "ADDRESS_LINE_1",
                "address_line2": "ADDRESS_LINE_2",
                "address": "ADDRESS",
                "landmark": "LANDMARK",
                "area": "AREA",
                "mobile": "MOBILE_NUMBER",
                "alternate_mobile": "ALTERNATE_MOBILE_NUMBER",
                "annotation": "ANNOTATION",
                "instructions": "INSTRUCTIONS",
                "voice_directions_s3_uri": "S3_URI",
                "email": "EMAIL"
              },
              "other_data": ".."
            }
          ]
        }
      }
    },
    "owner": "0x322b8f7573..",
    "timestampS": 1695149749,
    "context": "Swiggy User",
    "identifier": "0x0085d4c..",
    "epoch": 2
  },
  "signatures": [
    "0xaf5c8dfdd.."
  ],
  "witnessHosts": [
    "https://reclaim-node.questbook.app"
  ]
}

onFail Callback

Error: An Error occured while creating claim

Try out Swiggy Implementation

Example

We have included an example project in the root directory to implement a Swiggy provider to extract user Address. You can find this here (opens in a new tab).

After cloning the repository, navigate to the example folder, install the dependencies, and run the project.