Skip to content

Repository created for a Flutter package developed in Dart, which aims to find out if a certain element exists or not within any list.

License

Notifications You must be signed in to change notification settings

Markfgui675/exists_in

Repository files navigation

Package Flutter: exists_in

This package aims to find out if a certain element exists or not in a list.

Package

Explanation

Application is simple.

  • The first parameter to be passed is the element to be searched for within the list.
  • The second parameter is the list, in which the element to be searched may or may not be.
existsIn(dynamic element, List<dynamic> list)

Example

After verification, True is returned if the element exists in the list or False if the element does not exist.

List<int> nums = [1, 4, 5, 6, 8];
existsIn(4, nums)
import 'package:exists_in/exists_in.dart';
import 'package:flutter/material.dart';

void main(){
  runApp(MaterialApp(
    home: MyWidget(),
  ));
}

class MyWidget extends StatefulWidget {
  const MyWidget({super.key});

  @override
  State<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {

  List<int> nums = [1, 4, 5, 6, 8];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        title: const Text('Exists In?'),
        centerTitle: true,
      ),
      body: Center(
        child: existsIn(4, nums) ? const Text('Exists') : const Text("Don't exists")
      ),
    );
  }
}

About

Repository created for a Flutter package developed in Dart, which aims to find out if a certain element exists or not within any list.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages