flutter_number_checker 0.0.2 copy "flutter_number_checker: ^0.0.2" to clipboard
flutter_number_checker: ^0.0.2 copied to clipboard

A new flutter package for checking number easily. This package is for checking number is prime or not. In future theire will be more option to check diffrenet number.

Flutter Number Checker #

A flutter plugin for checking number easily.

Note: This plugin is still under development, and some checking might not be available yet.

Features #

  • Check number is prime number or not

Getting started #

Add dependency:

Please check the latest version before installation. If there is any problem with the new version, please use the previous version.

dependencies:
  flutter:
    sdk: flutter
  # add flutter_number_checker
  flutter_number_checker : ^{latest version}

or run this command:

 flutter pub add flutter_number_checker

Add the following imports to your Dart code/ Flutter Code:

import 'package:flutter_number_checker/flutter_number_checker.dart';

Usage #

Will add longer examples into /example folder.

 int number = 7;
 int number2 = 10;

 // check number is prime number or not normal way.
 bool isPrime = await FlutterNumberChecker.isPrimeNumber(number);
 print(isPrime); // true

 // check number is prime number or not using extention method.
  bool isPrime2 = number2.isPrimeNumber();
  print(isPrime2); // false
  • Check number is prime number or not on flutter: #

    • First, you need to import the package:
 import 'package:flutter_number_checker/flutter_number_checker.dart';
  • Create a project decleare HomeScreen as a StatefulWidget:
  void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Number Checker',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomeScreen(title: 'Flutter Number Checker'),
    );
  }
}
  • Create a variable to store the number you want to check:
  class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key, required this.title});
  final String title;

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  num number = 7;
  num number2 = 10;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
        centerTitle: true,
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text(
                ' $number is: ',
                style: Theme.of(context).textTheme.headline4,
              ),
              Text(
                number.isPrimeNumber ? 'PRIME' : 'NOT PRIME',
                style: Theme.of(context)
                    .textTheme
                    .headline4
                    ?.copyWith(color: Colors.black),
              ),
            ],
          ),
          const SizedBox(height: 20),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text(
                ' $number2 is: ',
                style: Theme.of(context).textTheme.headline4,
              ),
              Text(
                number2.isPrimeNumber ? 'PRIME' : 'NOT PRIME',
                style: Theme.of(context)
                    .textTheme
                    .headline4
                    ?.copyWith(color: Colors.black),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
  • Run the project and you will see the result:
Home Screen

Additional information #

Contributing #

This is a open source project so anyone want to contribute on this proejct is most welcome. Go to Github - Flutter Number Checker and fork the project. Then clone the project and make changes. After that create a pull request. I will review the changes and merge it if it is good.

Project Maintainer ❤️

Md. Al-Amin
Md. Al-Amin

✨VALUABLE CONTRIBUTORS✨

Happy Coding 👨‍💻

License #


Copyright (c) 2022 Md. Al-Amin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5
likes
0
pub points
30%
popularity

Publisher

unverified uploader

A new flutter package for checking number easily. This package is for checking number is prime or not. In future theire will be more option to check diffrenet number.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_number_checker