MusicDuration class

A rhythmic duration: a DurationType plus augmentation dots.

Why this type has two names

This class is exported by package:flutter_notemus/flutter_notemus.dart under BOTH MusicDuration and the legacy alias Duration. MusicDuration is the canonical name and the one to use in new code.

The legacy name shadows dart:core.Duration for anyone importing the package barrel, which is a real and repeatedly-hit trap:

import 'package:flutter_notemus/flutter_notemus.dart';

Timeout(Duration(minutes: 5));   // does NOT compile: this is the music one
Future.delayed(Duration(seconds: 1));  // same

Two ways out, both supported today:

// 1. Keep the time Duration, name the music one explicitly.
import 'package:flutter_notemus/flutter_notemus.dart' hide Duration;
final quarter = MusicDuration(DurationType.quarter);
await Future.delayed(const Duration(seconds: 1));   // dart:core, unshadowed

// 2. Prefix the package.
import 'package:flutter_notemus/flutter_notemus.dart' as notemus;
final quarter = notemus.MusicDuration(notemus.DurationType.quarter);

The Duration alias is kept so that no existing code breaks. It is scheduled to stop being exported in 3.0; MusicDuration will remain. There is no deprecation annotation on it yet precisely because that would emit a warning at every one of the several hundred call sites inside this package and in every app using it, before there is a major version to land the removal in.

Constructors

MusicDuration(DurationType type, {int dots = 0})
const

Properties

absoluteValue double
Calcula a duração real incluindo pontos de aumento. Fórmula: valor_original + (valor_original * 0.5^1) + (valor_original * 0.5^2) + ...
no setter
dots int
O número de pontos de aumento.
final
hashCode int
The hash code for this object.
no setteroverride
realValue double
Calcula a duração real incluindo pontos de aumento.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type DurationType
O tipo de duração (semibreve, mínima, etc.).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Representação legível, ex.: MusicDuration(quarter) ou MusicDuration(half..).
override

Operators

operator ==(Object other) bool
Duas durações são iguais quando têm o mesmo type e o mesmo número de dots.
override