A Dart library with a solution to use smart enums

Overview

Smart Enums

Author: Jop Middelkamp

A package that can help you create 'smarter' enums that could be extended with some domain logic.

Usage

final bestFramework = Framework.flutter;

print('${bestFramework == Framework.flutter}'); // Prints 'true'
print('${bestFramework == Framework.maui}'); // Prints 'false'

class Framework extends SmartEnum<Framework> {
  static const Framework flutter = Framework._(
    1,
    name: 'Flutter',
    isCrossPlatform: true,
    score: 10,
  );
  static const Framework maui = Framework._(
    2,
    name: 'MAUI',
    isCrossPlatform: true,
    score: 8,
  );
  static const Framework reactNative = Framework._(
    4,
    name: 'React Native',
    isCrossPlatform: true,
    score: 9,
  );

  const Framework._(
    int value, {
    required this.name,
    required this.isCrossPlatform,
    required this.score,
  }) : super(value);

  final String name;
  final bool isCrossPlatform;
  final int score;

  static List<Framework> get crossPlatformFrameworks => const [
        Framework.flutter,
        Framework.maui,
        Framework.reactNative,
      ].where((f) => f.isCrossPlatform).toList();
}

Note

Inspired by Steve Smith's smart enum .NET library.

You might also like...

Concepts used Flutter layout,State management, Blockchain integration, Http api integration, Smart contracts

HS_CryptoCoin_Wallet First project using Flutter with Blockchain Getting Started This project is a starting point for a Flutter application. A few res

Dec 23, 2021

Flutter Modular - A smart project structure

Flutter Modular - A smart project structure

Flutter Modular Getting started with Modular flutter_modular Documentation flutter_modular_test Documentation modular_codegen Documentation Features a

Jan 5, 2023

A bot to swap instantly tokens using PancakeSwap smart contracts

Swap Pancake Bot Swap Pancake Bot foi feito para fazer swaps instantâneos sem ne

Jan 6, 2022

P2P payment solution using Stream's Flutter SDK and Rapyd's Wallet API

P2P payment solution using Stream's Flutter SDK and Rapyd's Wallet API

Peer-to-peer payment integration to a messaging app using Flutter 💰 This project shows how to integrate a peer-to-peer payment solution to your Strea

Dec 8, 2022

Plaso Connect is an application which acts as a one-stop solution where the people requiring blood plasma/oxygen can directly find and contact the donors and healthcare units as per their requirements

Plaso Connect is an application which acts as a one-stop solution where the people requiring blood plasma/oxygen can directly find and contact the donors and healthcare units as per their requirements

PLASO CONNECT - The Lifeline A one-stop platform for COVID relief resources -- Connecting patients with Plasma donors and oxygen suppliers. Built for

Oct 28, 2022

A low-cost Flutter screen adaptation solution(一个极低成本的 Flutter 屏幕适配方案)

A low-cost Flutter screen adaptation solution(一个极低成本的 Flutter 屏幕适配方案)

A low-cost Flutter screen adaptation solution(一个极低成本的 Flutter 屏幕适配方案) 100% 还原 UI,只需要按照设计图写的宽高写即可 先看图片,设置的标准宽度是 360 iPhone 8 --------------------------

Sep 27, 2022

Sharik is an open-source, cross-platform solution for sharing files via Wi-Fi or Mobile Hotspot

Sharik is an open-source, cross-platform solution for sharing files via Wi-Fi or Mobile Hotspot

Share files across devices with Sharik! It works with Wi-Fi connection or Tethering (Wi-Fi Hotspot). No internet connection needed. Contributing Feel

Jan 1, 2023

a software to connect you and your friends and others, are you guys also just tensed over the overuse of social media so we have a solution, appx (name not decided yet)

appx a software to connect you and your friends and others, are you guys also just tensed over the overuse of social media so we have a solution, appx

Jun 9, 2022

An Advanced Logging Framework develop in flutter that provides quick & simple logging solution.

An Advanced Logging Framework develop in flutter that provides quick & simple logging solution.

FLogs Advance Logging Framework FLog is an Advanced Logging Framework develop in flutter that provides quick & simple logging solution. All logs are s

Dec 30, 2022
Owner
Jop Middelkamp
Jop Middelkamp
Easy to use open source Hub 🕸️ to control your smart devices from one app.

CyBear Jinni Hub Welcome! This repository is in charge of controlling smart devices and is part of the CyBear Jinni Smart Home system. The software is

CyBear Jinni 26 Nov 23, 2022
Easy to use open source Hub 🕸️ to control your smart devices from one app.

CyBear Jinni Hub Welcome! This repository is in charge of controlling smart devices and is part of the CyBear Jinni Smart Home system. The software is

CyBear Jinni 13 Jul 22, 2021
Flutter example project to run Solidity smart contracts using web3Dart library

Fluthereum Description Flutter example project to run Solidity smart contracts using web3Dart library Dependencies web3dart: A dart library that conne

Marcos Carlomagno 72 Dec 27, 2022
Flutter Smart Admin Panel & Dashboard

?? ?? Smart Admin Panel & Dashboard Flutter Web Smart Admin & Panel Dashboard with flutter UI kit. Support ⭐️ If you want to access the backend(Fireba

Deniz Çolak 333 Dec 25, 2022
Flutter UI challenge (with Box2D physic)- Smart washing machine app

Flutter UI Challenge- SMART Washing Machine About project The application was written based on this great UI concept: https://dribbble.com/shots/11018

Tomasz Pawlikowski 754 Dec 27, 2022
Transform your smart devices to intelligent communicators.

Donna According to a survey of 601 people, 57.9 % of participants experienced communication difficulties, with 23.5 % reporting severe difficulties. O

Betaoverflow 9 Dec 19, 2022
This is a smart farming app which helps farmers to remotely monitor their crop and take necessary actions. It also has a feature called disease detection.

Smart-Farming-App This is a smart farming app which helps farmers to remotely monitor their crop and take necessary actions. It has features called di

Nihar Shah 2 Jul 9, 2022
A smart Diet and Fitness App

studio_projects A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

null 1 Oct 25, 2021
Smart Home Controlling App

wifi_smart_home_five Hinox Wifi Smart Home App Getting Started This project is a starting point for a Flutter application. A few resources to get you

Hiloliddin 1 Nov 10, 2021
Smart course app built in flutter.

flutter_smart_course Smart course app is built in flutter. App design is based on Smart Course designed by Nugraha Jati Utama Screenshots Android Home

Sonu Sharma 627 Jan 3, 2023