Skip to content

Commit

Permalink
Merge pull request #521 from solid-illiaaihistov/Replace-Dart-Code-Me…
Browse files Browse the repository at this point in the history
…trics-with-Solid-Lints

Replace dart code metrics with solid lints
  • Loading branch information
solid-illiaaihistov authored Feb 20, 2025
2 parents 4024950 + dd12cff commit 9132fa1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 51 deletions.
25 changes: 3 additions & 22 deletions .github/workflows/code_check_for_flutter_vlc_player.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,12 @@ jobs:
working-directory: ./flutter_vlc_player
run: flutter pub get

- name: Setup Dart Code Metrics
- name: Run Solid Lints
working-directory: ./flutter_vlc_player
run: dart pub get dart_code_metrics
run: dart analyze

- name: Dart Code Metrics
working-directory: ./flutter_vlc_player
run: |
dirs_to_analyze=""
if [ -d lib ]; then dirs_to_analyze+=" lib"; fi
if [ -d test ]; then dirs_to_analyze+=" test"; fi
if [ -d example ]; then dirs_to_analyze+=" example"; fi
if [ dirs_to_analyze != "" ]
then
dart run dart_code_metrics:metrics \
analyze \
$dirs_to_analyze \
--fatal-warnings \
--fatal-performance \
--fatal-style
dart run dart_code_metrics:metrics \
check-unused-files \
$dirs_to_analyze \
--fatal-unused
fi
- name: Check formatting
working-directory: ./flutter_vlc_player
run: dart format . --set-exit-if-changed

- name: Run tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,10 @@ jobs:
working-directory: ./flutter_vlc_player_platform_interface
run: flutter pub get

- name: Setup Dart Code Metrics
- name: Run Solid Lints
working-directory: ./flutter_vlc_player_platform_interface
run: dart pub get dart_code_metrics
run: dart analyze

- name: Dart Code Metrics
working-directory: ./flutter_vlc_player_platform_interface
run: |
dirs_to_analyze=""
if [ -d lib ]; then dirs_to_analyze+=" lib"; fi
if [ -d test ]; then dirs_to_analyze+=" test"; fi
if [ -d example ]; then dirs_to_analyze+=" example"; fi
if [ dirs_to_analyze != "" ]
then
dart run dart_code_metrics:metrics \
analyze \
$dirs_to_analyze \
--fatal-warnings \
--fatal-performance \
--fatal-style
dart run dart_code_metrics:metrics \
check-unused-files \
$dirs_to_analyze \
--fatal-unused
fi
- name: Check formatting
working-directory: ./flutter_vlc_player_platform_interface
run: dart format . --set-exit-if-changed
Expand Down
10 changes: 8 additions & 2 deletions flutter_vlc_player/example/lib/single_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class _SingleTabState extends State<SingleTab> {
await Future<void>.delayed(const Duration(seconds: 1));
final tempVideo = await _loadVideoToFs();
await Future<void>.delayed(const Duration(seconds: 1));
if (!mounted) break;
if (!context.mounted) break;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Now trying to play...'),
Expand All @@ -229,7 +229,7 @@ class _SingleTabState extends State<SingleTab> {
if (await tempVideo.exists()) {
await _controller.setMediaFromFile(tempVideo);
} else {
if (!mounted) break;
if (!context.mounted) break;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('File load error.'),
Expand Down Expand Up @@ -264,3 +264,9 @@ class _SingleTabState extends State<SingleTab> {
await _controller.dispose();
}
}

class MyClass {
final int _myField = 0;

int get myField => _myField;
}
3 changes: 2 additions & 1 deletion flutter_vlc_player/lib/src/vlc_player_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,8 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> {
_throwIfNotInitialized('getVolume');
final volume = await vlcPlayerPlatform.getVolume(_viewId);
value = value.copyWith(
volume: volume != null ? volume.clamp(0, _maxVolume) : null);
volume: volume?.clamp(0, _maxVolume),
);

return volume;
}
Expand Down
8 changes: 4 additions & 4 deletions flutter_vlc_player/pigeons/messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class SnapshotMessage {

class SpuTracksMessage {
int? viewId;
Map? subtitles;
Map<Object?, Object?>? subtitles;
}

class SpuTrackMessage {
Expand All @@ -88,7 +88,7 @@ class AddSubtitleMessage {

class AudioTracksMessage {
int? viewId;
Map? audios;
Map<Object?, Object?>? audios;
}

class AudioTrackMessage {
Expand All @@ -105,7 +105,7 @@ class AddAudioMessage {

class VideoTracksMessage {
int? viewId;
Map? videos;
Map<Object?, Object?>? videos;
}

class VideoTrackMessage {
Expand Down Expand Up @@ -135,7 +135,7 @@ class RendererScanningMessage {

class RendererDevicesMessage {
int? viewId;
Map? rendererDevices;
Map<Object?, Object?>? rendererDevices;
}

class RenderDeviceMessage {
Expand Down

0 comments on commit 9132fa1

Please sign in to comment.