flutter_ntp 0.0.1 copy "flutter_ntp: ^0.0.1" to clipboard
flutter_ntp: ^0.0.1 copied to clipboard

A flutter implementation of (NTP) Network Time Protocol server.

example/lib/main.dart

import 'dart:developer';

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

void main() {
  runApp(const ExampleWidget());
}

class ExampleWidget extends StatelessWidget {
  const ExampleWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('NTP Example')),
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              try {
                DateTime currentTime = await FlutterNTP.now();
                log('Current NTP time: $currentTime');
              } catch (e) {
                log('Error fetching NTP time: $e');
              }
            },
            child: const Text('Fetch NTP Time'),
          ),
        ),
      ),
    );
  }
}
5
likes
160
points
70
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter implementation of (NTP) Network Time Protocol server.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_ntp