Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The method 'hashValues' isn't defined for the class 'DrmInitData' #1382

Open
kashyapsandesh opened this issue Feb 7, 2025 · 4 comments
Open
Assignees
Labels
new issue New issue which has not been checked yet

Comments

@kashyapsandesh
Copy link

../../../.pub-cache/hosted/pub.dev/better_player-0.0.84/lib/src/hls/hls_parser/drm_init_data.dart:22:23: Error: The method 'hashValues' isn't defined for the class 'DrmInitData'.

  • 'DrmInitData' is from 'package:better_player/src/hls/hls_parser/drm_init_data.dart' ('../../../.pub-cache/hosted/pub.dev/better_player-0.0.84/lib/src/hls/hls_parser/drm_init_data.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hashValues'.
    int get hashCode => hashValues(schemeType, schemeData);
    ^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/better_player-0.0.84/lib/src/hls/hls_parser/hls_track_metadata_entry.dart:31:23: Error: The method 'hashValues' isn't defined for the class 'HlsTrackMetadataEntry'.
  • 'HlsTrackMetadataEntry' is from 'package:better_player/src/hls/hls_parser/hls_track_metadata_entry.dart' ('../../../.pub-cache/hosted/pub.dev/better_player-0.0.84/lib/src/hls/hls_parser/hls_track_metadata_entry.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hashValues'.
    int get hashCode => hashValues(groupId, name, variantInfos);
    ^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/better_player-0.0.84/lib/src/hls/hls_parser/scheme_data.dart:52:23: Error: The method 'hashValues' isn't defined for the class 'SchemeData'.
  • 'SchemeData' is from 'package:better_player/src/hls/hls_parser/scheme_data.dart' ('../../../.pub-cache/hosted/pub.dev/better_player-0.0.84/lib/src/hls/hls_parser/scheme_data.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hashValues'.
    int get hashCode => hashValues(
    ^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/better_player-0.0.84/lib/src/hls/hls_parser/variant_info.dart:44:23: Error: The method 'hashValues' isn't defined for the class 'VariantInfo'.
  • 'VariantInfo' is from 'package:better_player/src/hls/hls_parser/variant_info.dart' ('../../../.pub-cache/hosted/pub.dev/better_player-0.0.84/lib/src/hls/hls_parser/variant_info.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hashValues'.
    int get hashCode => hashValues(
    ^^^^^^^^^^
    Target kernel_snapshot_program failed: Exception
@kashyapsandesh kashyapsandesh added the new issue New issue which has not been checked yet label Feb 7, 2025
@Shahidbangash
Copy link

same issue . i am using flutter 3.27.1

@Manudev24
Copy link

This solve the error for me. Clone the repository and add it to the local_libraries

drm_init_data.dart
import 'package:collection/collection.dart';
import 'package:flutter/cupertino.dart';

import 'scheme_data.dart';

class DrmInitData {
DrmInitData({this.schemeType, this.schemeData = const []});

final List schemeData;
final String? schemeType;

@OverRide
bool operator ==(dynamic other) {
if (other is DrmInitData) {
return schemeType == other.schemeType &&
const ListEquality().equals(other.schemeData, schemeData);
}
return false;
}

@OverRide
int get hashCode => Object.hash(schemeType, schemeData);
}

his_track_metadata_entry.dart
import 'package:better_player/src/hls/hls_parser/variant_info.dart';
import 'package:collection/collection.dart';
import 'package:flutter/rendering.dart';

class HlsTrackMetadataEntry {
HlsTrackMetadataEntry({this.groupId, this.name, this.variantInfos});

/// The GROUP-ID value of this track, if the track is derived from an EXT-X-MEDIA tag. Null if the
/// track is not derived from an EXT-X-MEDIA TAG.
final String? groupId;

/// The NAME value of this track, if the track is derived from an EXT-X-MEDIA tag. Null if the
/// track is not derived from an EXT-X-MEDIA TAG.
final String? name;

/// The EXT-X-STREAM-INF tags attributes associated with this track. This field is non-applicable (and therefore empty) if this track is derived from an EXT-X-MEDIA tag.
final List? variantInfos;

@OverRide
bool operator ==(dynamic other) {
if (other is HlsTrackMetadataEntry) {
return other.groupId == groupId &&
other.name == name &&
const ListEquality()
.equals(other.variantInfos, variantInfos);
}
return false;
}

@OverRide
int get hashCode => Object.hash(groupId, name, variantInfos);
}

scheme_data.dart
import 'dart:typed_data';

import 'package:flutter/material.dart';

class SchemeData {
SchemeData({
this.licenseServerUrl,
required this.mimeType,
this.data,
this.requiresSecureDecryption,
});

/// The URL of the server to which license requests should be made. May be null if unknown.
final String? licenseServerUrl;

/// The mimeType of [data].
final String mimeType;

/// The initialization base data.
/// you should build pssh manually for use.
final Uint8List? data;

/// Whether secure decryption is required.
final bool? requiresSecureDecryption;

SchemeData copyWithData(Uint8List? data) => SchemeData(
licenseServerUrl: licenseServerUrl,
mimeType: mimeType,
data: data,
requiresSecureDecryption: requiresSecureDecryption,
);

@OverRide
bool operator ==(dynamic other) {
if (other is SchemeData) {
return other.mimeType == mimeType &&
other.licenseServerUrl == licenseServerUrl &&
other.requiresSecureDecryption == requiresSecureDecryption &&
other.data == data;
}

return false;

}

@OverRide
int get hashCode =>
Object.hash(licenseServerUrl, mimeType, data, requiresSecureDecryption);
}

variant_info.dart
import 'package:flutter/material.dart';

class VariantInfo {
VariantInfo({
this.bitrate,
this.videoGroupId,
this.audioGroupId,
this.subtitleGroupId,
this.captionGroupId,
});

/// The bitrate as declared by the EXT-X-STREAM-INF tag. */
final int? bitrate;

/// The VIDEO value as defined in the EXT-X-STREAM-INF tag, or null if the VIDEO attribute is not
/// present.
final String? videoGroupId;

/// The AUDIO value as defined in the EXT-X-STREAM-INF tag, or null if the AUDIO attribute is not
/// present.
final String? audioGroupId;

/// The SUBTITLES value as defined in the EXT-X-STREAM-INF tag, or null if the SUBTITLES
/// attribute is not present.
final String? subtitleGroupId;

/// The CLOSED-CAPTIONS value as defined in the EXT-X-STREAM-INF tag, or null if the
/// CLOSED-CAPTIONS attribute is not present.
final String? captionGroupId;

@OverRide
bool operator ==(dynamic other) {
if (other is VariantInfo) {
return other.bitrate == bitrate &&
other.videoGroupId == videoGroupId &&
other.audioGroupId == audioGroupId &&
other.subtitleGroupId == subtitleGroupId &&
other.captionGroupId == captionGroupId;
}
return false;
}

@OverRide
int get hashCode => Object.hash(
bitrate, videoGroupId, audioGroupId, subtitleGroupId, captionGroupId);
}

@Lo4D
Copy link

Lo4D commented Feb 14, 2025

This package seems to be abandoned. I've forked it and fixed the latest flutter compatibility issues along with some other stuff.
You can use it by adding:
To pubspec.yaml

better_player:
    git: https://github.com/Lo4D/better-player-ultra.git

@GokulRajQuilt
Copy link

GokulRajQuilt commented Feb 15, 2025

This package seems to be abandoned. I've forked it and fixed the latest flutter compatibility issues along with some other stuff. You can use it by adding: To pubspec.yaml

better_player:
    git: https://github.com/Lo4D/better-player-ultra.git

This solution worked for me.
Instead of forking you can make a PR to better player? Sorry if I am missing something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new issue New issue which has not been checked yet
Projects
None yet
Development

No branches or pull requests

6 participants