Skip to content

Instantly share code, notes, and snippets.

@sachaarbonel
Last active February 25, 2021 20:16
Show Gist options
  • Save sachaarbonel/6521db7299f4e9abd92316fec6849c76 to your computer and use it in GitHub Desktop.
Save sachaarbonel/6521db7299f4e9abd92316fec6849c76 to your computer and use it in GitHub Desktop.
main
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
final client = StreamChatClient('b67pax5b2wdq', logLevel: Level.INFO); //we want to see debug
//logs in our terminal
await client.connectUser(
User(
id: 'cool-shadow-7',
extraData: {
'image':
'https://getstream.io/random_png/?id=cool-shadow-7&name=Cool+shadow',
},
),
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiY29vbC1zaGFkb3ctNyJ9.gkOlCRb1qgy4joHPaxFwPOdXcGvSPvp6QY0S4mpRkVo',
);
runApp(IMessage(client: client));
}
class IMessage extends StatelessWidget {
final StreamChatClient client;
IMessage({@required this.client});
@override
Widget build(BuildContext context) {
initializeDateFormatting('en_US', null);//we need this for dateFormat utils
return CupertinoApp(
title: 'Flutter Demo',
theme: CupertinoThemeData(brightness: Brightness.light),
home: StreamChatCore(client: client, child: ChatLoader()),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment