vihaya_sdk_flutter 0.1.1
vihaya_sdk_flutter: ^0.1.1 copied to clipboard
Official Flutter SDK for the Vihaya Events platform. Fetch events, register attendees, handle custom fields, and verify Razorpay payments with a fully-typed client.
Vihaya SDK for Flutter & Dart — Official vihaya_sdk_flutter Package #
vihaya_sdk_flutteris 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?
- Why the Vihaya Flutter SDK?
- The Vihaya SDK family
- Installation
- Get your Vihaya API key
- Quick start
- Configuration
- Core concepts
- Usage guide
- Flutter widget patterns
- Mega events & sub-events
- Razorpay payment flow
- API reference
- Error handling
- Security best practices
- FAQ
- Keywords
- Development
- Contributing
- License
🇮🇳 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.appproduction 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 #
- Sign up or log in at events.vihaya.app.
- Open the Developer Dashboard.
- Click Generate API Key and copy the
vh_live_...token. - Store it securely —
flutter_secure_storage,--dart-defineat 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 viaevent.subEvents. - Registrations — free or paid attendee entries with optional custom fields and team members.
- Payments — Razorpay orders created during
events.register, verified viapayments.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:
- Backend (your server) — proxy
client.events.register(eventId, data)→ returnsorderId. - Flutter app — launch
Razorpay()checkout withorder_id: orderId. - Razorpay callback —
_handlePaymentSuccess(PaymentSuccessResponse response). - 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.verifythrough 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 metadataSpeaker,Sponsor,AgendaItem,FAQItem,ContactCustomField,SpecialPrice,PromoCodeRegisterData— registration payloadVihayaConfig— client configurationVihayaException— 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.registerandpayments.verifythrough your own server for sensitive operations. - Use
flutter_secure_storageor 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.
- Fork Vishnu252005/vihaya-sdk-flutter.
- Create a feature branch.
- Run
flutter testanddart analyze. - 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 #
- 📧 Email: support@vihaya.app
- 🌐 Website: vihaya.app
- 🛠️ Dashboard: events.vihaya.app
- 👨💻 Developer docs: events.vihaya.app/profile/developer/docs
- 📦 pub.dev: pub.dev/packages/vihaya_sdk_flutter
- 🐛 Issues: github.com/Vishnu252005/vihaya-sdk-flutter/issues
Built with ❤️ by the Vihaya team.
Related Vihaya SDK repositories #
- Flutter / Dart: vihaya-sdk-flutter — you are here
- JavaScript / TypeScript: vihaya-sdk
- Python: vihaya-sdk-python
- Go: vihaya-sdk-go
- Java: vihaya-sdk-java
- Ruby: vihaya-sdk-ruby
- PHP: vihaya-sdk-php