This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package importer | |
type MutexEx struct { | |
c chan bool | |
} | |
func (m *MutexEx) Lock() { | |
<-m.c | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
class BandwidthBuffer<T> { | |
final Duration duration; | |
final void Function(List<T>) onReceive; | |
List<T> _list = <T>[]; | |
Timer _timer; | |
BandwidthBuffer({this.duration, this.onReceive}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
import 'bandwidth_buffer.dart'; | |
import 'chat_message.dart'; | |
import 'chat_message_incoming.dart'; | |
import 'chat_message_outgoing.dart'; | |
import 'chat_service.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:grpc/grpc.dart'; | |
import 'api/v1/chat.pbgrpc.dart' as grpc; | |
import 'api/v1/google/protobuf/empty.pb.dart'; | |
import 'api/v1/google/protobuf/wrappers.pb.dart'; | |
import 'chat_message.dart'; | |
import 'chat_message_outgoing.dart'; | |
/// CHANGE TO IP ADDRESS OF YOUR SERVER IF IT IS NECESSARY | |
const serverIP = "127.0.0.1"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'chat_message.dart'; | |
/// Outgoing message author name | |
const String _name = "Me"; | |
/// Outgoing message statuses | |
/// UNKNOWN - message just created and is not sent yet | |
/// SENT - message is sent to the server successfully |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'chat_message.dart'; | |
/// Incoming message author name | |
const String _server = "Server"; | |
/// ChatMessageIncoming is widget to display incoming from server message | |
class ChatMessageIncoming extends StatelessWidget implements ChatMessage { | |
/// Incoming message content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:uuid/uuid.dart'; | |
/// Message is class defining message data (id and text) | |
class Message { | |
/// _uuid is unique ID generator | |
static var _uuid = Uuid(); | |
/// id is unique ID of message | |
String id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'chat_screen.dart'; | |
/// FriendlychatApp is Flutter application | |
class FriendlychatApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: "Friendlychat", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'app.dart'; | |
/// main is entry point of Flutter application | |
void main() { | |
runApp(FriendlychatApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"os" | |
"github.com/amsokol/flutter-grpc-tutorial/go-server/pkg/protocol/grpc" | |
"github.com/amsokol/flutter-grpc-tutorial/go-server/pkg/service/v1" | |
) |
NewerOlder