Skip to content

Commit

Permalink
Pub.dev linter suggestions, first optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
terrabythia committed May 14, 2019
1 parent be98efd commit d9c4773
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
1 change: 0 additions & 1 deletion lib/casting/cast_channel.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
Expand Down
2 changes: 1 addition & 1 deletion lib/casting/cast_device.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CastDevice extends ChangeNotifier {
this.type,
this.host,
this.port,
this.attr = null,
this.attr,
}) {
initDeviceInfo();
}
Expand Down
23 changes: 6 additions & 17 deletions lib/casting/cast_sender.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class CastSender extends Object {

bool connectionDidClose;

Timer _heartbeatTimer;
Timer _receiverStatusTimer;
// Timer _heartbeatTimer;
Timer _mediaCurrentTimeTimer;

CastSession _castSession;
Expand Down Expand Up @@ -137,7 +136,7 @@ class CastSender extends Object {
loadPlaylist([media], forceNext: forceNext);
}

void loadPlaylist(List<CastMedia> media, {append: false, forceNext = false}) {
void loadPlaylist(List<CastMedia> media, { append = false, forceNext = false }) {
if (!append) {
_contentQueue = media;
}
Expand Down Expand Up @@ -318,7 +317,7 @@ class CastSender extends Object {

log.fine("Media status is empty");

if (null == _currentCastMedia && _contentQueue.length > 0) {
if (null == _currentCastMedia && _contentQueue.isNotEmpty) {
log.fine("no media is currently being casted, try to cast first in queue");
_handleContentQueue();
}
Expand All @@ -328,7 +327,7 @@ class CastSender extends Object {
}

_handleContentQueue({forceNext = false}) {
if (null == _mediaChannel || _contentQueue.length == 0) {
if (null == _mediaChannel || _contentQueue.isEmpty) {
return;
}
if (null != _castSession.castMediaStatus &&
Expand Down Expand Up @@ -364,19 +363,9 @@ class CastSender extends Object {
'type': 'PING'
});

_heartbeatTimer = Timer(Duration(seconds: 5), _heartbeatTick);
}

}

void _receiverStatusTick() {

if (null != _receiverChannel) {
_receiverChannel.sendMessage({
'type': 'GET_STATUS',
});
// _heartbeatTimer = Timer(Duration(seconds: 5), _heartbeatTick);
Timer(Duration(seconds: 5), _heartbeatTick);

_receiverStatusTimer = Timer(Duration(seconds: 5), _receiverStatusTick);
}

}
Expand Down
10 changes: 7 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: dart_chromecast
version: 0.1.0
description: Cast videos to your ChromeCast device
author: Sander Bruggeman <[email protected]>
homepage: https://github.com/terrabythia/dart_chromecast

environment:
sdk: '>=2.0.0 <3.0.0'

dependencies:
protobuf: any
http: any
protobuf: ^0.13.11
http: ^0.12.0+2
cli_util: ^0.1.3+2
args: ^1.4.0
xml: ^3.0.0
observable: any
observable: ^0.22.2
logging: ^0.11.3+2

0 comments on commit d9c4773

Please sign in to comment.