Vihaya SDK for Flutter & Dart โ€” Official vihaya_sdk_flutter Package

pub package pub points License: MIT Platform

vihaya_sdk_flutter is the official Flutter and Dart SDK for the Vihaya Events platform. Build attendee-facing mobile experiences for Android, iOS, Web, macOS, Windows, and Linux โ€” event listings, registration flows, ticketing, Razorpay payment verification, attendee dashboards, QR check-in, and rich event pages โ€” with a tiny, fully-typed Dart client.

Vihaya is the modern events platform for India โ€” a single stack for event organisers, ticketing, sponsor management, attendee registration, live check-in, and real-time analytics. This package is the fastest way to integrate the Vihaya Events API (https://events.vihaya.app) into any Flutter app or pure-Dart program.


Table of contents


๐Ÿ‡ฎ๐Ÿ‡ณ What is Vihaya?

Vihaya is an all-in-one events platform for India, built for organisers who run college fests, hackathons, conferences, workshops, meetups, bootcamps, summits, and corporate events. The Vihaya platform provides:

  • ๐ŸŽŸ๏ธ Event creation & ticketing with pricing tiers, promo codes, and a hosted checkout.
  • ๐Ÿข Mega events โ€” bundle dozens of sub-events under one parent fest.
  • ๐Ÿ’ณ Razorpay payments โ€” end-to-end with server-side signature verification.
  • ๐Ÿ“‹ Custom registration fields โ€” T-shirt size, college, team members, dietary preferences, accommodation.
  • ๐Ÿ‘ฅ Attendee management โ€” real-time registrations, broadcasts, CSV exports.
  • ๐Ÿ“ฑ Live check-in with mobile QR scanning.
  • ๐Ÿ‘ฉโ€๐Ÿซ Speakers, agenda, sponsors, FAQs.
  • ๐Ÿ“Š Analytics โ€” registrations, revenue, funnel tracking.

This vihaya_sdk_flutter package lets Flutter and Dart developers embed the Vihaya Events API into mobile apps, web apps, desktop apps, and pure Dart server-side projects.

Production URL: https://events.vihaya.app ยท Marketing site: https://vihaya.app ยท Developer dashboard: https://events.vihaya.app/profile/developer


โœจ Why the Vihaya Flutter SDK?

  • ๐ŸŒ True cross-platform โ€” works on Android, iOS, Web, macOS, Windows, and Linux. One codebase.
  • ๐Ÿ” Fully typed โ€” every Vihaya response is a typed Dart class with fromJson / toJson.
  • ๐Ÿ“ฆ Tiny โ€” built on package:http, no native code, no platform channels.
  • ๐ŸŽฏ Pure Dart โ€” works in Flutter apps and pure Dart (CLI tools, server-side, build scripts).
  • ๐Ÿงช Tested against the live events.vihaya.app production API.
  • ๐ŸŽ›๏ธ Rich models โ€” Event, Speaker, AgendaItem, Sponsor, FAQItem, CustomField, SpecialPrice, PromoCode, RegisterData, sub-events, team registrations.
  • ๐Ÿ’ณ Razorpay ready โ€” client.events.register() โ†’ Razorpay โ†’ client.payments.verify().
  • ๐Ÿ” Stream-friendly โ€” easy to wrap in FutureBuilder, StreamBuilder, Riverpod, BLoC, or GetX.

๐ŸŒ The Vihaya SDK family (7 languages)

Language Package Repository Install
๐Ÿ“ฑ Flutter / Dart vihaya_sdk_flutter Vishnu252005/vihaya-sdk-flutter flutter pub add vihaya_sdk_flutter
๐ŸŸจ JavaScript / TypeScript vihaya-sdk Vishnu252005/vihaya-sdk npm install vihaya-sdk
๐Ÿ Python vihaya-events Vishnu252005/vihaya-sdk-python pip install vihaya-events
๐Ÿฆซ Go vihaya-sdk-go Vishnu252005/vihaya-sdk-go go get github.com/Vishnu252005/vihaya-sdk-go
โ˜• Java vihaya-sdk-java Vishnu252005/vihaya-sdk-java JitPack / Gradle / Maven
๐Ÿ’Ž Ruby vihaya-events Vishnu252005/vihaya-sdk-ruby gem install vihaya-events
๐Ÿ˜ PHP vihaya/events Vishnu252005/vihaya-sdk-php composer require vihaya/events

All Vihaya SDKs target the same API base URL (https://events.vihaya.app), authenticate with the same x-api-key header, and expose the same methods.


๐Ÿ“ฆ Installation

Add to your pubspec.yaml:

dependencies:
  vihaya_sdk_flutter: ^0.1.0

Then install:

flutter pub get

Or use the CLI:

flutter pub add vihaya_sdk_flutter

For pure Dart projects (no Flutter):

dart pub add vihaya_sdk_flutter

The package supports Android, iOS, Web, macOS, Windows, and Linux, and Dart SDK 3.0+.


๐Ÿ”‘ Get your Vihaya API key

  1. Sign up or log in at events.vihaya.app.
  2. Open the Developer Dashboard.
  3. Click Generate API Key and copy the vh_live_... token.
  4. Store it securely โ€” flutter_secure_storage, --dart-define at build time, or proxy through your own backend.

โš ๏ธ Mobile security note: never ship a vh_live_... secret key inside your APK/IPA. Always proxy registrations through your own backend, or use a restricted public key scoped to read-only event listing.


๐Ÿš€ Quick start

import 'package:vihaya_sdk_flutter/vihaya_sdk_flutter.dart';

void main() async {
  final client = VihayaClient('YOUR_API_KEY');

  final events = await client.events.list();
  for (final event in events) {
    print('${event.title} โ€” ${event.location}');
  }
}

List events with error handling

try {
  final events = await client.events.list();
  for (final event in events) {
    print('${event.title} โ€” ${event.location}');
  }
} on VihayaException catch (e) {
  print('Vihaya error: ${e.message} (status ${e.status})');
}

Register an attendee

final registration = RegisterData(
  name:  'Anjali Mehta',
  email: 'anjali@example.com',
  phone: '+919820012345',
  customFields: {
    'T-Shirt Size': 'L',
    'College':      'Vihaya Institute',
  },
);

final response = await client.events.register('evt_8x42j9', registration);

if (response['isPaid'] == true) {
  final orderId = response['orderId'];
  // Launch Razorpay Checkout with orderId, then verify server-side
  await client.payments.verify(
    paymentId: 'pay_xxx',
    orderId:   orderId,
    signature: 'sig_xxx',
  );
} else {
  print('Registered! ID: ${response['registrationId']}');
}

โš™๏ธ Configuration

import 'package:vihaya_sdk_flutter/vihaya_sdk_flutter.dart';

// Simple constructor
final client = VihayaClient('vh_live_...');

// With full configuration
final client = VihayaClient(VihayaConfig(
  apiKey:  'vh_live_...',
  baseUrl: 'https://events.vihaya.app',  // override for staging
  headers: {
    'X-Trace-Id': 'abc123',
  },
  timeout: const Duration(seconds: 60),
));

๐Ÿงญ Core concepts

  • Events โ€” the root record. Title, description, date, venue, tiers, custom fields, speakers, agenda, sponsors, FAQs, sub-events.
  • Mega events โ€” parent events containing sub-events. Detect with event.eventType == 'megaEvent', iterate via event.subEvents.
  • Registrations โ€” free or paid attendee entries with optional custom fields and team members.
  • Payments โ€” Razorpay orders created during events.register, verified via payments.verify.
  • API key โ€” vh_live_... token from the developer dashboard.

๐Ÿ“š Usage guide

Fetch a full event

events.get() returns an Event with everything you need to render a rich event page or build a custom registration form โ€” speakers, agenda, sponsors, FAQs, custom fields, and pricing tiers.

final event = await client.events.get('event-id');

print('Title: ${event.title}');
print('Mode: ${event.eventMode}');
print('Timezone: ${event.timezone}');
print('Date: ${event.date} ${event.time}');
print('Location: ${event.location}');

event.speakerList?.forEach((s) => print('- ${s.name} (${s.role}) @ ${s.company}'));
event.agendaList?.forEach((a) => print('[${a.time}] ${a.title}'));
event.sponsors?.forEach((sp) => print('${sp.name} (${sp.tier})'));
event.faqs?.forEach((faq) => print('Q: ${faq.question}\nA: ${faq.answer}\n'));
event.specialPrices?.forEach((tier) => print('  ${tier.name}: โ‚น${tier.amount}'));

event.customFields?.forEach((field) {
  final req = field.required ? 'required' : 'optional';
  print('  ${field.name} [${field.type}] $req');
});

List & filter events

final events = await client.events.list();

final mega    = events.where((e) => e.eventType == 'megaEvent').toList();
final freeOnes = events.where((e) => e.isFree == true).toList();
final online  = events.where((e) => e.eventMode == 'online').toList();

Register with tiers, promo codes, and custom fields

await client.events.register('evt_conf_2026', RegisterData(
  name:  'Priya Raj',
  email: 'priya@example.com',
  phone: '+919820012345',
  tier:  'Early Bird',
  promoCode: 'LAUNCH10',
  customFields: {
    'College':       'IIT Bombay',
    'T-Shirt Size':  'M',
    'Year of Study': '3rd',
  },
));

Register a hackathon team

await client.events.register('evt_hackathon_2026', RegisterData(
  name:     'Team Lead',
  email:    'lead@example.com',
  phone:    '+919820012345',
  teamName: 'Byte Squad',
  teamMembers: [
    {'name': 'Alice', 'email': 'alice@example.com', 'phone': '+91...'},
    {'name': 'Bob',   'email': 'bob@example.com',   'phone': '+91...'},
    {'name': 'Carol', 'email': 'carol@example.com', 'phone': '+91...'},
  ],
));

๐Ÿงฑ Flutter widget patterns

FutureBuilder event list

class EventListScreen extends StatelessWidget {
  final VihayaClient client;
  const EventListScreen({super.key, required this.client});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Vihaya Events')),
      body: FutureBuilder<List<Event>>(
        future: client.events.list(),
        builder: (context, snapshot) {
          if (snapshot.connectionState == ConnectionState.waiting) {
            return const Center(child: CircularProgressIndicator());
          }
          if (snapshot.hasError) {
            return Center(child: Text('Error: ${snapshot.error}'));
          }
          final events = snapshot.data!;
          return ListView.builder(
            itemCount: events.length,
            itemBuilder: (_, i) {
              final event = events[i];
              return ListTile(
                title:    Text(event.title),
                subtitle: Text('${event.date} ยท ${event.location}'),
                onTap:    () => Navigator.push(context, MaterialPageRoute(
                  builder: (_) => EventDetailScreen(client: client, eventId: event.id),
                )),
              );
            },
          );
        },
      ),
    );
  }
}

Riverpod provider

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:vihaya_sdk_flutter/vihaya_sdk_flutter.dart';

final vihayaProvider = Provider<VihayaClient>(
  (ref) => VihayaClient('YOUR_API_KEY'),
);

final eventsProvider = FutureProvider<List<Event>>((ref) async {
  return ref.watch(vihayaProvider).events.list();
});

final eventDetailProvider = FutureProvider.family<Event, String>((ref, id) async {
  return ref.watch(vihayaProvider).events.get(id);
});
class EventListPage extends ConsumerWidget {
  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final eventsAsync = ref.watch(eventsProvider);

    return eventsAsync.when(
      data: (events) => ListView(
        children: events.map((e) => ListTile(title: Text(e.title))).toList(),
      ),
      loading: () => const CircularProgressIndicator(),
      error: (err, _) => Text('Error: $err'),
    );
  }
}

BLoC

class EventBloc extends Bloc<EventEvent, EventState> {
  final VihayaClient client;

  EventBloc(this.client) : super(EventInitial()) {
    on<LoadEvents>((event, emit) async {
      emit(EventLoading());
      try {
        final events = await client.events.list();
        emit(EventLoaded(events));
      } on VihayaException catch (e) {
        emit(EventError(e.message));
      }
    });
  }
}

Building a dynamic registration form

The Vihaya SDK gives you everything to render a dynamic registration form in a single events.get() call โ€” pricing tiers, custom fields, accommodation options.

class EventRegistrationForm extends StatefulWidget {
  final Event event;
  // ...

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        // Tiers
        if (event.specialPrices != null)
          ...event.specialPrices!.map((tier) => RadioListTile<String>(
                title: Text('${tier.name} โ€” โ‚น${tier.amount}'),
                value: tier.name,
                groupValue: selectedTier,
                onChanged: (v) => setState(() => selectedTier = v),
              )),

        // Custom fields
        if (event.customFields != null)
          ...event.customFields!.map((field) {
            if (field.type == 'dropdown') {
              return DropdownButtonFormField<String>(
                decoration: InputDecoration(labelText: field.name),
                items: field.options
                    ?.map((o) => DropdownMenuItem(value: o, child: Text(o)))
                    .toList(),
                onChanged: (v) => customFieldValues[field.name] = v ?? '',
              );
            }
            return TextFormField(
              decoration: InputDecoration(labelText: field.name),
              onChanged: (v) => customFieldValues[field.name] = v,
            );
          }),

        // Accommodation
        if (event.hasAccommodation == true)
          CheckboxListTile(
            title: Text('Accommodation (โ‚น${event.accommodationPrice})'),
            subtitle: Text(event.accommodationDetails ?? ''),
            value: needsAccommodation,
            onChanged: (v) => setState(() => needsAccommodation = v ?? false),
          ),

        // Submit
        ElevatedButton(
          onPressed: _submit,
          child: const Text('Register'),
        ),
      ],
    );
  }
}

๐Ÿข Mega events & sub-events

final fest = await client.events.get('evt_mega_fest_2026');

if (fest.eventType == 'megaEvent') {
  print('${fest.title} โ€” ${fest.subEvents?.length ?? 0} sub-events');

  fest.subEvents?.forEach((sub) {
    final price = sub.isFree == true ? 'Free' : 'โ‚น${sub.price}';
    print('  - ${sub.title} ($price)');

    sub.customFields?.forEach((field) {
      print('    * ${field.name} [${field.type}]');
    });
  });
}

Register for a specific sub-event:

await client.events.register('evt_sub_workshop_ml', RegisterData(
  name:  'Rahul',
  email: 'rahul@example.com',
  phone: '+91...',
));

๐Ÿ’ณ Razorpay payment flow

Vihaya uses Razorpay for payments. The flow integrates beautifully with the official razorpay_flutter package:

  1. Backend (your server) โ€” proxy client.events.register(eventId, data) โ†’ returns orderId.
  2. Flutter app โ€” launch Razorpay() checkout with order_id: orderId.
  3. Razorpay callback โ€” _handlePaymentSuccess(PaymentSuccessResponse response).
  4. Backend โ€” call client.payments.verify(...) to mark the registration paid.
import 'package:razorpay_flutter/razorpay_flutter.dart';

class CheckoutFlow {
  final Razorpay _razorpay = Razorpay();
  final VihayaClient client;
  late String currentOrderId;

  CheckoutFlow(this.client) {
    _razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _onSuccess);
    _razorpay.on(Razorpay.EVENT_PAYMENT_ERROR,   _onError);
  }

  Future<void> startCheckout(String eventId, RegisterData data) async {
    final result = await client.events.register(eventId, data);
    currentOrderId = result['orderId'];

    _razorpay.open({
      'key':      'rzp_live_xxx',
      'amount':   result['amount'],
      'order_id': currentOrderId,
      'name':     'Vihaya Events',
      'prefill':  {'contact': data.phone, 'email': data.email},
    });
  }

  void _onSuccess(PaymentSuccessResponse response) async {
    await client.payments.verify(
      paymentId: response.paymentId!,
      orderId:   response.orderId!,
      signature: response.signature!,
    );
  }

  void _onError(PaymentFailureResponse response) {
    // handle error
  }
}

โš ๏ธ Always verify payments on the server. Never trust a signature checked only on-device. Proxy payments.verify through your own backend.


๐Ÿ“– API reference

VihayaClient(apiKey) / VihayaClient(VihayaConfig(...))

The main client.

client.events

Method Description
list() Returns all active events on the authenticated account.
get(id) Full metadata for one event including tiers, fields, agenda, speakers, sponsors, FAQs, sub-events.
register(id, data) Submits a registration. Returns orderId for paid events, registrationId for free.

client.payments

Method Description
verify(paymentId, orderId, signature) Server-side Razorpay signature verification.

Models

  • Event โ€” root event with all metadata
  • Speaker, Sponsor, AgendaItem, FAQItem, Contact
  • CustomField, SpecialPrice, PromoCode
  • RegisterData โ€” registration payload
  • VihayaConfig โ€” client configuration
  • VihayaException โ€” thrown on every API failure

๐Ÿšจ Error handling

All API failures raise VihayaException:

try {
  await client.events.get('invalid-id');
} on VihayaException catch (e) {
  print('Message: ${e.message}');
  print('Status:  ${e.status}');
  print('Body:    ${e.data}');

  switch (e.status) {
    case 404: /* not found */ break;
    case 401:
    case 403: /* auth */ break;
    case 429: /* rate limit */ break;
  }
}

๐Ÿ›ก๏ธ Security best practices

Never hard-code your vh_live_... secret key in a Flutter build that ships to end-users.

  • Ship only restricted public keys to mobile apps. Keep the secret on your backend.
  • Proxy events.register and payments.verify through your own server for sensitive operations.
  • Use flutter_secure_storage or platform secure storage for any short-lived tokens.
  • Pass keys at build time via --dart-define=VIHAYA_API_KEY=... rather than committing them.
  • Always verify Razorpay signatures server-side.
  • Rotate keys via the Vihaya developer dashboard if leaked.

โ“ FAQ

What is Vihaya?

Vihaya is an events platform for India โ€” ticketing, registrations, payments, check-in, analytics, and attendee management. Platform: vihaya.app. Dashboard: events.vihaya.app.

Does the SDK work on Web, macOS, Windows, and Linux?

Yes. It's built on package:http which works on all six Flutter platforms.

Does it work in pure Dart (no Flutter)?

Yes. The package has no Flutter-specific dependencies โ€” use it in CLI tools, server-side Dart, build scripts, or Dart Edge.

Does it work with Riverpod, BLoC, GetX, Provider, MobX?

Yes. The client is a plain Dart object โ€” wrap it in any state management pattern you prefer.

How do I integrate with razorpay_flutter?

See the Razorpay payment flow section above. The Vihaya SDK creates the order; razorpay_flutter opens checkout; the SDK verifies the signature server-side.

Can I ship my live secret key in the APK?

No. Always proxy through your own backend or use a restricted public key. Mobile binaries can be reverse-engineered.


๐Ÿ”Ž Keywords

vihaya ยท vihaya sdk ยท vihaya flutter ยท vihaya dart ยท vihaya sdk flutter ยท vihaya_sdk_flutter ยท vihaya events flutter ยท vihaya api flutter ยท flutter events api ยท flutter ticketing sdk ยท flutter razorpay events ยท vihaya razorpay flutter ยท events api india flutter ยท event management sdk flutter ยท dart events sdk ยท riverpod vihaya ยท bloc vihaya ยท getx vihaya ยท flutter event app ยท pub.dev vihaya ยท events.vihaya.app flutter ยท vihaya official flutter sdk ยท dart pub vihaya


๐Ÿ› ๏ธ Development

git clone https://github.com/Vishnu252005/vihaya-sdk-flutter.git
cd vihaya-sdk-flutter
flutter pub get
flutter test
dart analyze

๐Ÿค Contributing

Contributions to the Vihaya Flutter SDK are very welcome. The project is open source and MIT-licensed.

  1. Fork Vishnu252005/vihaya-sdk-flutter.
  2. Create a feature branch.
  3. Run flutter test and dart analyze.
  4. Commit, push, and open a Pull Request.

Reporting issues

Found a bug or have a feature request? Open an issue at github.com/Vishnu252005/vihaya-sdk-flutter/issues.


๐Ÿ“„ License

MIT ยฉ Vihaya. See LICENSE.


๐Ÿ’ฌ Support

Built with โค๏ธ by the Vihaya team.


Libraries

vihaya_sdk_flutter
Official Flutter SDK for the Vihaya Events platform.