first_day_of_the_week 1.0.0 copy "first_day_of_the_week: ^1.0.0" to clipboard
first_day_of_the_week: ^1.0.0 copied to clipboard

Flutter plugin for getting system's first day of the week.

first_day_of_the_week #

first_day_of_the_week is a Flutter plugin that allows you to retrieve the system's first day of the week on both Android and iOS. This can be particularly useful for calendar and scheduling applications.

Features #

  • Get the system's first day of the week.
  • Supports both Android and iOS platforms.

Installation #

Add first_day_of_the_week to your pubspec.yaml file:

dependencies:
  first_day_of_the_week: ^1.0.0

Then run:

flutter pub get

Usage #

First, ensure you initialize the plugin by calling the init method. This will retrieve and set the first day of the week from the system.

import 'package:first_day_of_the_week/first_day_of_the_week.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize the plugin to get the first day of the week
  await FirstDayOfTheWeek.init();

  // Access the first day of the week
  int? firstDay = FirstDayOfTheWeek.value;
  print("The first day of the week is: $firstDay");

  runApp(MyApp());
}

Day of the Week Mapping #

The days of the week are represented as follows:

  • 1 - Sunday
  • 2 - Monday
  • 3 - Tuesday
  • 4 - Wednesday
  • 5 - Thursday
  • 6 - Friday
  • 7 - Saturday

Example #

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize the plugin to get the first day of the week
  await FirstDayOfTheWeek.init();

  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('First Day of the Week Example'),
        ),
        body: Center(
          child: Text(
            'The first day of the week is: ${FirstDayOfTheWeek.value}',
            style: TextStyle(fontSize: 24),
          ),
        ),
      ),
    );
  }
}

Contributing #

Contributions are welcome! Please open an issue or submit a pull request.

License #

This project is licensed under the MIT License. See the LICENSE file for more details.

3
likes
160
points
50
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for getting system's first day of the week.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on first_day_of_the_week

Packages that implement first_day_of_the_week