You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

flet-asp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flet-asp

Flet-ASP – The Flet Atomic State Pattern is a reactive state management library for Flet.

0.1.0
pipPyPI
Maintainers
1

flet-asp

Flet-ASP - Flet Atomic State Pattern

📖 Overview

Flet-ASP (Flet Atomic State Pattern) is a reactive state management library for Flet, bringing atom-based architecture and separation of concerns into Python apps — inspired by Flutter's Riverpod and ASP.

It provides predictable, testable, and declarative state through:

  • Atom – single reactive unit of state
  • Selector – derived/computed state
  • Action – handles async workflows like login, fetch, etc.

📦 Installation

Install using your package manager of choice:

Pip

pip install flet-asp

Poetry

poetry add flet-asp

UV

uv add flet-asp

📦 Features

✅ Reactive atoms (with controlled mutation)
✅ Selector (sync & async derived values)
✅ Async-safe Actions
✅ One-way and two-way binding (form inputs)
✅ Lightweight and framework-agnostic
✅ Built for Flet

🧪 Example – Basic Counter

import flet as ft
import flet-asp as fa


def main(page: ft.Page):
    state = fa.get_state_manager(page)
    state.atom("count", 0)

    count_ref = ft.Ref[ft.Text]()

    def increment(e):
        state.set("count", state.get("count") + 1)

    page.add(
        ft.Text(ref=count_ref),
        ft.ElevatedButton("Increment", on_click=increment)
    )

    state.bind("count", count_ref)


if __name__ == "__main__":
    ft.app(target=main)

📁 Examples Included

Explore the examples/ folder for full apps:

🧩 Design System Ready

atomic_design

Flet-ASP also allows you to create applications following the Atomic Design System, just like Flutter.

Atomic LayerHow Flet-ASP Helps
AtomsSimple reactive values (e.g., atom("email"), atom("count"), atom("message"), atom("loading")
SelectorsDerived state (e.g., @selector("full_name"), @selector("total_price") or Selector(...))
ActionsEncapsulate side effects (API, auth)
Bindingsbind(), bind_two_way() for full UI ↔ state reactivity
Molecules/OrganismsCombine logic in components
TemplatesReuse UIs across screens

Learn more:

🌐 Community

Join the community to contribute or get help:

⭐ Support

If you like this project, please give it a GitHub star and stay tuned for future updates!

🤝🏽 Contributing

Contributions and feedback are welcome!

🔧 How to contribute:

  • Fork the repository.
  • Create a feature branch.
  • Submit a pull request with a detailed explanation of your changes.

💬 How to give feedback:

We value your opinion! Feel free to share suggestions, ideas, or constructive criticism to help improve the project.

  • Open an issue.
  • Describe the problem or suggestion clearly
  • Optionally propose a solution

🕓 Waiting for help?

Be patient — or reach out to the community on Discord for quicker responses.

Commit your work to the LORD, and your plans will succeed. Proverbs 16: 3

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts