dumb_api_dart 1.0.5 copy "dumb_api_dart: ^1.0.5" to clipboard
dumb_api_dart: ^1.0.5 copied to clipboard

Dart/Flutter API for DUMBMessenger

DUMB Messenger API #

made by debianrose!

Why? #

Just for fun. And for android client

Usage Example in Dart #

import 'package:chat_client/chat_client.dart';

// Create client instance
final client = ChatClient(
  baseUrl: 'http://localhost:3000',
  token: 'your-auth-token',
);

// Authentication
final loginResult = await client.login('username', 'password');
if (loginResult.requires2FA) {
  // Handle 2FA
  final verified = await client.verify2FALogin(
    'username', 
    loginResult.sessionId!, 
    '123456'
  );
}

// Send message
final message = await client.sendMessage(
  channel: 'general',
  text: 'Hello World!',
);

// WebSocket for real-time updates
final channel = client.createWebSocketChannel();
channel.stream.listen((data) {
  final message = ChatMessage.fromJson(json.decode(data));
  // Handle incoming message
});

Example Usage in Flutter #

import 'package:chat_client/chat_client.dart';

class ChatService {
  late ChatClient client;
  
  Future<void> init(String token) async {
    client = ChatClient(
      baseUrl: 'https://localhost:3000',
      token: token,
    );
  }
  
  Future<void> sendMessage(String channel, String text) async {
    try {
      final message = await client.sendMessage(
        channel: channel,
        text: text,
      );
      print('Message sent: ${message.id}');
    } on ChatException catch (e) {
      print('Error: ${e.message}');
    }
  }
}
0
likes
120
points
47
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart/Flutter API for DUMBMessenger

Homepage

License

unknown (license)

Dependencies

crypto, http, image, web_socket_channel

More

Packages that depend on dumb_api_dart