chat_application 0.0.1 copy "chat_application: ^0.0.1" to clipboard
chat_application: ^0.0.1 copied to clipboard

A chat application package that uses shared preferences to store user credentials

example/main.dart

// example/main.dart
import 'package:flutter/material.dart';
import 'package:chat_application/chat_application.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  final ChatApplication chatApp = ChatApplication(
    userId: '123',
    token: 'token123',
    firebaseToken: 'firebaseToken123',
  );

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Chat Application Example')),
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              await chatApp.fetchChats();
              print('Fetching chats...');
            },
            child: Text('Get Chats'),
          ),
        ),
      ),
    );
  }
}