Skip to content

Commit

Permalink
docs: add necessary code docs for public properties
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar-deriv committed Jul 18, 2024
1 parent 8731f4c commit 8b9a3f6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ class CallLogController extends NetworkLogsController {
}) : super(emitter: callEmitter);

final TextEditingController _searchController = TextEditingController();
final List<CallLogVM> _callLogs = <CallLogVM>[];

/// Search controller for searching logs.
TextEditingController get searchController => _searchController;
final List<CallLogVM> _callLogs = <CallLogVM>[];

@override
void incomingLog(NetworkLogPayload log) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ abstract class NetworkLogsController extends ChangeNotifier {
emitter?.stream.listen(incomingLog);
}

/// Incoming log from the stream.
void incomingLog(NetworkLogPayload log);

/// converts raw message to readable json format.
String getReadableBody(Object message) {
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
return encoder.convert(message);
}

/// Checks if payload is request.
bool isRequest(NetworkLogPayload log) => log.direction == LogDirection.sent;

/// It will trigger the rebuild of the widget.
void searchLogs(String value) {
notifyListeners();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import 'package:deriv_logger/controllers/network_logs_controller.dart';
import 'package:deriv_logger/services/network_service.dart';
import 'package:flutter/material.dart';

/// Controller for handling subscription logs.
class SubscriptionLogController extends NetworkLogsController {
/// Constructor for SubscriptionLogController.
SubscriptionLogController({
NetworkLogEmitter? subscriptionEmitter,
}) : super(emitter: subscriptionEmitter);
Expand Down
2 changes: 2 additions & 0 deletions packages/deriv_logger/lib/services/network_service.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
abstract interface class NetworkLogEmitter {
/// A Stream of network logs.
/// Logs are displayed in UI based on this stream and [NetworkPayload].
Stream<NetworkLogPayload> get stream;
}

Expand Down
3 changes: 3 additions & 0 deletions packages/deriv_logger/lib/views/subscription_log_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import 'package:deriv_logger/views/logger_theme.dart';
import 'package:deriv_logger/widgets/controller_provider.dart';
import 'package:flutter/material.dart';

/// This widget is used to display the subscription logs with request payload and
/// all the responses.
class SubscriptionLogsView extends StatelessWidget {
/// Constructor for SubscriptionLogsView.
const SubscriptionLogsView({
required this.theme,
super.key,
Expand Down

0 comments on commit 8b9a3f6

Please sign in to comment.