Skip to content

Commit

Permalink
Updated dart constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbagyastha committed May 15, 2019
1 parent 51706a1 commit fb9f12e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/src/youtube_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ class _Player extends StatefulWidget {
class __PlayerState extends State<_Player> with AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
super.build(context);
return IgnorePointer(
ignoring: true,
child: WebView(
Expand Down Expand Up @@ -452,7 +453,7 @@ class __PlayerState extends State<_Player> with AutomaticKeepAliveClientMixin {
name: 'Errors',
onMessageReceived: (JavascriptMessage message) {
widget.controller.value = widget.controller.value
.copyWith(errorCode: int.parse(message.message ?? 0));
.copyWith(errorCode: int.tryParse(message.message) ?? 0);
},
),
JavascriptChannel(
Expand All @@ -471,7 +472,7 @@ class __PlayerState extends State<_Player> with AutomaticKeepAliveClientMixin {
JavascriptChannel(
name: 'CurrentTime',
onMessageReceived: (JavascriptMessage message) {
double position = double.parse(message.message) * 1000;
double position = double.tryParse(message.message) ?? 0 * 1000;
widget.controller.value = widget.controller.value.copyWith(
position: Duration(
milliseconds: position.floor(),
Expand All @@ -483,7 +484,7 @@ class __PlayerState extends State<_Player> with AutomaticKeepAliveClientMixin {
name: 'LoadedFraction',
onMessageReceived: (JavascriptMessage message) {
widget.controller.value = widget.controller.value.copyWith(
buffered: double.parse(message.message),
buffered: double.tryParse(message.message) ?? 0,
);
},
),
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ packages:
name: ytview
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.7+2"
version: "0.0.7+4"
sdks:
dart: ">=2.2.0 <3.0.0"
flutter: ">=1.0.0 <2.0.0"
flutter: ">=1.5.0 <2.0.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: Sarbagya Dhaubanjar <sarbagyastha@gmail.com>
homepage: https://github.com/sarbagyastha/youtube_player_flutter

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.2.0 <3.0.0"

dependencies:
flutter:
Expand Down

0 comments on commit fb9f12e

Please sign in to comment.