Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Unable to include the package in a Flutter app #7

@cjarman

Description

@cjarman

import 'package:timezone/standalone.dart';
import 'package:timezone/timezone.dart';

class MyHomePageState extends State {
@OverRide
void initState() {
initializeTimeZone().then((
) {
final detroit = getLocation('America/Detroit');
final now = new TZDateTime.now(detroit);
});
}
}

Compile time warning is as follows:

compiler message: file:///Users/craigjarman/.pub-cache/hosted/pub.dartlang.org/timezone-0.4.3/lib/src/date_time.dart:321:34: Error: The parameter 'other' of the method 'TZDateTime::difference' has type timezone.src.date_time::TZDateTime, which does not match the corresponding type in the overridden method (dart.core::DateTime).
compiler message: Change to a supertype of dart.core::DateTime (or, for a covariant parameter, a subtype).
compiler message: Duration difference(TZDateTime other) {
compiler message: ^
compiler message: file:///b/build/slave/Linux_Engine/build/src/third_party/dart/runtime/lib/date_patch.dart: Context: This is the overriden method ('difference').
compiler message: file:///Users/craigjarman/.pub-cache/hosted/pub.dartlang.org/timezone-0.4.3/lib/src/date_time.dart:386:36: Error: The parameter 'other' of the method 'TZDateTime::isAtSameMomentAs' has type timezone.src.date_time::TZDateTime, which does not match the corresponding type in the overridden method (dart.core::DateTime).
compiler message: Change to a supertype of dart.core::DateTime (or, for a covariant parameter, a subtype).
compiler message: bool isAtSameMomentAs(TZDateTime other) {
compiler message: ^
compiler message: file:///b/build/slave/Linux_Engine/build/src/third_party/dart/sdk/lib/core/date_time.dart: Context: This is the overriden method ('isAtSameMomentAs').
compiler message: file:///Users/craigjarman/.pub-cache/hosted/pub.dartlang.org/timezone-0.4.3/lib/src/date_time.dart:396:28: Error: The parameter 'other' of the method 'TZDateTime::compareTo' has type timezone.src.date_time::TZDateTime, which does not match the corresponding type in the overridden method (dart.core::DateTime).
compiler message: Change to a supertype of dart.core::DateTime (or, for a covariant parameter, a subtype).
compiler message: int compareTo(TZDateTime other) => millisecondsSinceEpoch.compareTo(other.millisecondsSinceEpoch);
compiler message: ^
compiler message: file:///b/build/slave/Linux_Engine/build/src/third_party/dart/sdk/lib/core/date_time.dart: Context: This is the overriden method ('compareTo').
compiler message: file:///Users/craigjarman/.pub-cache/hosted/pub.dartlang.org/timezone-0.4.3/lib/src/date_time.dart:11:7: Error: The non-abstract class 'TZDateTime' is missing implementations for these members:
compiler message: 'microsecondsSinceEpoch', 'microsecond'.
compiler message: Try to either
compiler message: - provide an implementation,
compiler message: - inherit an implementation from a superclass or mixin,
compiler message: - mark the class as abstract, or
compiler message: - provide a 'noSuchMethod' implementation.
compiler message:
compiler message: class TZDateTime implements DateTime {
compiler message: ^^^^^^^^^^
compiler message: file:///b/build/slave/Linux_Engine/build/src/third_party/dart/runtime/lib/date_patch.dart: Context: 'microsecondsSinceEpoch' is defined here.
compiler message: file:///b/build/slave/Linux_Engine/build/src/third_party/dart/runtime/lib/date_patch.dart: Context: 'microsecond' is defined here.
Compiler failed on lib/main.dart

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions