jit_flutter_app_helper 0.0.5
jit_flutter_app_helper: ^0.0.5 copied to clipboard
Converts `DateTime` to all possible String formats
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:jit_flutter_app_helper/jit_flutter_app_helper.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _jitFlutterAppHelperPlugin = JitFlutterAppHelper();
String ans = '';
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
// pass the Date of DateTime format as an argument in the method
// the method formatDate will return a String of date like Monday, 09 September 2024
String date = _jitFlutterAppHelperPlugin.formatWeekNumberYYYY(DateTime.now());
if (!mounted) return;
setState(() {
ans = date;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
children: [
Text(ans),
],
),
),
),
);
}
}