All Projects → GetStream → build-viking-sample

GetStream / build-viking-sample

Licence: other
Sample app for Build Viking.

Programming Languages

dart
5743 projects
ruby
36898 projects - #4 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to build-viking-sample

SocialMedia-App
A fully functional social media app built with flutter with multiple features
Stars: ✭ 646 (+1983.87%)
Mutual labels:  chat-application, flutter-apps, flutter-examples
connectycube-flutter-samples
Code samples for Flutter, based on ConnectyCube platform
Stars: ✭ 64 (+106.45%)
Mutual labels:  chat-application, flutter-apps, flutter-examples
flutter pokedex
Pokedex app built with Flutter (with lots of animations) using Clean Architecture
Stars: ✭ 1,603 (+5070.97%)
Mutual labels:  flutter-apps, flutter-examples
flutter-system
Flutter Widgets,Components,Demos,Pages:从入门到产品级开发
Stars: ✭ 29 (-6.45%)
Mutual labels:  flutter-apps, flutter-examples
Manji
Manji is a mobile application built to help people learning Japanese learn about Kanji.
Stars: ✭ 142 (+358.06%)
Mutual labels:  flutter-apps, flutter-examples
flutter mentor app
Mentor app is built in flutter.
Stars: ✭ 39 (+25.81%)
Mutual labels:  flutter-apps, flutter-examples
smart-home-dashboard
No description or website provided.
Stars: ✭ 25 (-19.35%)
Mutual labels:  flutter-apps, flutter-examples
flutter-samples
A collection of sample apps that use Stream
Stars: ✭ 238 (+667.74%)
Mutual labels:  flutter-apps, flutter-examples
flutter-app
Full Feature Todos Flutter Mobile app with fireStore integration.
Stars: ✭ 138 (+345.16%)
Mutual labels:  flutter-apps, flutter-examples
calmly
Calmly is made with flutter to practice meditation to bring headspace and calmness. 😍💆🏼‍♂️
Stars: ✭ 34 (+9.68%)
Mutual labels:  flutter-apps, flutter-examples
flutter and cloudinary
How to build Photo Diary App using Flutter and Cloudinary
Stars: ✭ 17 (-45.16%)
Mutual labels:  flutter-apps, flutter-examples
DevQuiz
Dev.Quiz 👨‍💻 | Rocketseat 💜 - NLW 05 👩‍🚀
Stars: ✭ 25 (-19.35%)
Mutual labels:  flutter-apps, flutter-examples
Flutter-Cryptowallet
Flutter based Cryptowallet App
Stars: ✭ 73 (+135.48%)
Mutual labels:  flutter-apps, flutter-examples
vpn app
Simple Vpn app concept UI done in Flutter.
Stars: ✭ 67 (+116.13%)
Mutual labels:  flutter-apps, flutter-examples
flutter examples
Random flutter examples
Stars: ✭ 18 (-41.94%)
Mutual labels:  flutter-apps, flutter-examples
Churu
出入是一款用Flutter开发的简约记账应用。
Stars: ✭ 44 (+41.94%)
Mutual labels:  flutter-apps, flutter-examples
rijksbook
🖼 A basic Flutter app built for educational purposes
Stars: ✭ 37 (+19.35%)
Mutual labels:  flutter-apps, flutter-examples
Flutter-Chat-Bar
Link to the package -. https://pub.dartlang.org/packages/flutter_chat_bar
Stars: ✭ 39 (+25.81%)
Mutual labels:  chat-application, flutter-examples
connectycube-flutter-call-kit
A Flutter plugin for displaying call screen when the app in the background or terminated.
Stars: ✭ 35 (+12.9%)
Mutual labels:  flutter-apps, flutter-examples
car rental lite
A platform for car sharing where users can book any car that suits their needs and wants for their intended journey, from the closest hosts in the community.
Stars: ✭ 28 (-9.68%)
Mutual labels:  flutter-apps, flutter-examples

Build Viking 🛠

This repo contains sample code for Stream's Build Viking activity. Demo Gif


Prerequisites 🧬

This to run this application, you must have the following:

  • Flutter 1.24.0-7.0.pre or higher installed
  • A Stream account
  • An api.dart file in lib/ containing the following:
class API {
  static const apiUrl =
      "YOUR_API_URL";
  static const streamApi = "YOUR_STREAM_API_KEY";
}

Build Instructions

This project consists of two parts, the application (this repo) and a simple API that verifies a Flutter Viking ticket ID and creates a [Stream] user associated with that ID.

You can implement a custom API using the sample code below or remove it entirely by eliminating the call to __fetchUserAccount on line 20 of lib/services/api_service.dart. In its place, you can return an instance of VikingUser containing placeholder information.

Note, if you chose the latter, you would need to generate a user token manually using our online tool.

import { StreamChat } from 'stream-chat';
import axios from 'axios';

export const stream = async event => {
	const data = JSON.parse(event.body);

	try {
		const res = await axios.get(`${process.env.TICKET_URL}${data.id}`, {
			headers: {
				Authorization: `Token token=${process.env.TICKET_SECRET}`,
				'Content-Type': 'application/json',
			},
		});

		const client = new StreamChat(process.env.STREAM_API_KEY, process.env.STREAM_API_SECRET);

		const ticket = res.data.ticket;

		const user = {
			id: ticket.id.toString(),
			name: ticket.name,
			role: 'channel_member',
			image: 'https://stream-blog-v2.imgix.net/blog/wp-content/uploads/35e4570ddc67c374f9dbbf57c743acaa/dash.png',
		};

		const token = client.createToken(user.id);

		await client.upsertUser(user);

		return {
			statusCode: 200,
			headers: {
				'Access-Control-Allow-Origin': '*',
			},
			body: JSON.stringify({
				data: {
					token,
					id: user.id,
					name: user.name,
					image: user.image,
				},
			}),
		};
	} catch (error) {
		console.error(error);
		
		return {
			statusCode: error.response.status,
			headers: {
				'Access-Control-Allow-Origin': '*',
			},
			body: JSON.stringify({
				message: error.message,
			}),
		};
	}
};

Finally, you can run the application using regular Flutter build commands.

  1. Run flutter packages get to install the project dependencies
  2. Launch the application in debug mode using flutter run -d <name-of-your-device>

Happy Hacking!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].