iso8601_duration 0.0.4 copy "iso8601_duration: ^0.0.4" to clipboard
iso8601_duration: ^0.0.4 copied to clipboard

A package to format duration from ISO 8601 duration format. It can parse string in either PnYnMnDTnHnMnS or PnW format. It will return the duration in ISODuration type.

example/lib/main.dart

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

void main(List<String> args) {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final ISODurationConverter converter = ISODurationConverter();
    final String durationString = 'PT9H25M';
    final ISODuration duration =
        converter.parseString(isoDurationString: durationString);
    return Scaffold(
      appBar: AppBar(
        title: Text(
          'ISO 8601 Duration Conversion Demo ',
        ),
      ),
      body: Center(
        child: Column(
          children: [
            Text(
              duration.day.toString(),
            ),
            Text(
              duration.toString(),
            )
          ],
        ),
      ),
    );
  }
}
3
likes
160
pub points
81%
popularity

Publisher

unverified uploader

A package to format duration from ISO 8601 duration format. It can parse string in either PnYnMnDTnHnMnS or PnW format. It will return the duration in ISODuration type.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on iso8601_duration