{"id":634,"date":"2026-10-22T20:17:32","date_gmt":"2026-10-22T18:17:32","guid":{"rendered":"https:\/\/appsdeveloper.es\/?page_id=634"},"modified":"2026-11-04T00:06:24","modified_gmt":"2026-11-03T23:06:24","slug":"arquitectura","status":"publish","type":"page","link":"https:\/\/appsdeveloper.es\/en\/arquitectura\/","title":{"rendered":"Architecture"},"content":{"rendered":"<style>.project-card__footer a.btn:empty{display:none}\n.arch-list li{margin-bottom:12px;line-height:1.6}\n.arch-dg{margin:32px 0 40px;font-family:\"JetBrains Mono\",monospace}\n.arch-dg__row{display:grid;grid-template-columns:1fr auto 1fr auto 1fr;align-items:center;gap:12px}\n.arch-dg__box{background:#242424;border:1px solid rgba(255,107,0,.25);border-radius:6.4px;padding:18px 12px;text-align:center}\n.arch-dg__box strong{display:block;font-family:\"Barlow Condensed\",sans-serif;font-size:1.5rem;letter-spacing:.04em;text-transform:uppercase;color:#f0f0f0}\n.arch-dg__box span{display:block;font-size:.72rem;color:#999;margin-top:4px}\n.arch-dg__box--core{margin-top:12px;border-style:dashed}\n.arch-dg__box--domain{border-color:#ff6b00;box-shadow:0 0 0 1px #ff6b00 inset}\n.arch-dg__box--domain strong{color:#ff6b00}\n.arch-dg__arrow{color:#ff6b00;font-size:1.4rem}\n.arch-dg__up{text-align:center;color:#ff6b00;font-size:.75rem;margin-top:12px;letter-spacing:.08em}\n@media(max-width:700px){.arch-dg__row{grid-template-columns:1fr}.arch-dg__arrow{transform:rotate(90deg);text-align:center}}\n<\/style>\n\n\n<div class=\"protheme-page-hero reveal\">\n  <div class=\"container\">\n          <p class=\"protheme-page-hero__breadcrumb mono\">\n        <a href=\"\/en\/\">Home<\/a>\n        <span class=\"sep\"> \/ <\/span>Architecture      <\/p>\n        <h1 class=\"protheme-page-hero__title\">\n      My      <span class=\"accent\"> architecture<\/span>    <\/h1>\n          <p class=\"protheme-page-hero__subtitle mono\">\/\/ How I structure a Flutter app so it scales, can be tested and stays easy to maintain over time.<\/p>\n      <\/div>\n<\/div>\n\n<section class=\"section section--surface\">\n  <div class=\"container\">\n    \n<div class=\"protheme-section-header reveal\" style=\"text-align:left\">\n  <span class=\"section-label-block mono\">Principles<\/span>  <h2 class=\"section-title-block\">\n    Why<span class=\"accent\"> Clean Architecture<\/span>  <\/h2>\n<\/div>\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">01<\/span>\n          <\/div>\n    <h3 class=\"project-card__title\">Separation by layers<\/h3>\n    <p class=\"project-card__desc\">Each responsibility lives in its layer. The interface doesn't know where the data comes from and the data doesn't know how it will be painted.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">Core<\/span><span class=\"badge badge--dot\">Domain<\/span><span class=\"badge badge--dot\">Data<\/span><span class=\"badge badge--dot\">Presentation<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">02<\/span>\n          <\/div>\n    <h3 class=\"project-card__title\">Dependencies towards the domain<\/h3>\n    <p class=\"project-card__desc\">Presentation and Data depend on the domain, never the other way around. The domain is pure Dart: it knows nothing about Flutter, the network or storage.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">Interfaces<\/span><span class=\"badge badge--dot\">Dependency inversion<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">03<\/span>\n          <\/div>\n    <h3 class=\"project-card__title\">Cache-first<\/h3>\n    <p class=\"project-card__desc\">Repositories look at local data first and only go to the network when nothing is stored. The app responds fast and works without a connection.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">Offline<\/span><span class=\"badge badge--dot\">Performance<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">04<\/span>\n          <\/div>\n    <h3 class=\"project-card__title\">Everything can be tested<\/h3>\n    <p class=\"project-card__desc\">Each piece receives its dependencies through the constructor. That way use cases, repositories, mappers and BLoCs are tested in isolation.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">Dependency injection<\/span><span class=\"badge badge--dot\">Unit tests<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n<\/div>\n\n  <\/div>\n<\/section>\n\n<section class=\"section\">\n  <div class=\"container\">\n    \n<div class=\"protheme-section-header reveal\" style=\"text-align:left\">\n  <span class=\"section-label-block mono\">The layers<\/span>  <h2 class=\"section-title-block\">\n    Four layers,<span class=\"accent\"> one responsibility each<\/span>  <\/h2>\n<\/div>\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:#999999\">An app is divided into four layers with strict dependency rules. The arrows show who knows whom: everything points to the domain and the core layer supports the rest.<\/p>\n\n\n<div class=\"protheme-arch protheme-arch--vertical reveal\">\n    <div class=\"protheme-arch__row\">\n                <div class=\"protheme-arch__box\">\n        <strong>Presentation<\/strong>\n                  <span class=\"mono\">BLoC \u00b7 Cubit \u00b7 pages \u00b7 widgets<\/span>\n              <\/div>\n                  <div class=\"protheme-arch__arrow\" aria-hidden=\"true\">\u2192<\/div>\n            <div class=\"protheme-arch__box is-highlight\">\n        <strong>Domain<\/strong>\n                  <span class=\"mono\">entities \u00b7 use cases \u00b7 contracts<\/span>\n              <\/div>\n                  <div class=\"protheme-arch__arrow\" aria-hidden=\"true\">\u2190<\/div>\n            <div class=\"protheme-arch__box\">\n        <strong>Data<\/strong>\n                  <span class=\"mono\">datasources \u00b7 DTO\/DBO \u00b7 mappers \u00b7 repositories<\/span>\n              <\/div>\n      <\/div>\n  \n      <div class=\"protheme-arch__support mono\">\u2191 Core supports all layers \u2191<\/div>\n  \n      <div class=\"protheme-arch__box protheme-arch__base\">\n      <strong>Core<\/strong>\n              <span class=\"mono\">services \u00b7 dependency injection \u00b7 network \u00b7 navigation \u00b7 errors \u00b7 configuration<\/span>\n          <\/div>\n  <\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">Core<\/span>\n      <span class=\"badge badge--outline\">lib\/core<\/span>    <\/div>\n    <h3 class=\"project-card__title\">Shared infrastructure<\/h3>\n    <p class=\"project-card__desc\">Everything the whole app uses: network services, navigation, connectivity and logging, dependency injection, per-environment configuration and centralized error handling. It imports nothing from the other layers.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">GetIt \u00b7 injectable<\/span><span class=\"badge badge--dot\">Dio<\/span><span class=\"badge badge--dot\">Interceptors<\/span><span class=\"badge badge--dot\">Errors<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">Domain<\/span>\n      <span class=\"badge badge--outline\">lib\/layers\/domain<\/span>    <\/div>\n    <h3 class=\"project-card__title\">Business rules<\/h3>\n    <p class=\"project-card__desc\">Pure Dart. Immutable entities, repository contracts and one use case per business action. It is the most stable layer because it depends on no other, neither Flutter nor external packages.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">Entities<\/span><span class=\"badge badge--dot\">Use cases<\/span><span class=\"badge badge--dot\">Contracts<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">Data<\/span>\n      <span class=\"badge badge--outline\">lib\/layers\/data<\/span>    <\/div>\n    <h3 class=\"project-card__title\">Data access<\/h3>\n    <p class=\"project-card__desc\">It talks to the outside world. Remote and local datasources that return DTOs and DBOs, mappers that turn them into entities, and repositories that decide where each piece of data comes from. DTOs never leave this layer.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">DTO \u00b7 DBO<\/span><span class=\"badge badge--dot\">Mappers<\/span><span class=\"badge badge--dot\">Repositories<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">Presentation<\/span>\n      <span class=\"badge badge--outline\">lib\/layers\/presentation<\/span>    <\/div>\n    <h3 class=\"project-card__title\">User interface<\/h3>\n    <p class=\"project-card__desc\">Each screen is a feature with its BLoC or Cubit, its page and its widgets. The view only paints states and fires events. Navigation, dialogs and notices are also handled from the BLoC.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">BLoC \u00b7 Cubit<\/span><span class=\"badge badge--dot\">Pages<\/span><span class=\"badge badge--dot\">Widgets<\/span><span class=\"badge badge--dot\">Theme<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n<\/div>\n\n  <\/div>\n<\/section>\n\n<section class=\"section section--surface\">\n  <div class=\"container\">\n    \n<div class=\"protheme-section-header reveal\" style=\"text-align:left\">\n  <span class=\"section-label-block mono\">Data flow<\/span>  <h2 class=\"section-title-block\">\n    From the tap<span class=\"accent\"> to the screen<\/span>  <\/h2>\n<\/div>\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:#999999\">This is how a piece of data travels from the moment the user taps the screen until they see the result. Each step has a single responsibility.<\/p>\n\n\n<div class=\"pf reveal\" data-pf data-count=\"6\" data-autoplay=\"1\"\n  data-l-go=\"Tap\" data-l-out=\"Going\" data-l-back=\"Returning\"\n  data-l-play=\"Play\" data-l-stop=\"Stop\">\n  <div class=\"pf__grid\">\n    <div class=\"pf__scene\">\n      <div class=\"pf__nodes\" role=\"tablist\" aria-label=\"Flow steps\">\n        <button type=\"button\" class=\"pf__node pf__node--phone\" role=\"tab\" data-n=\"1\" data-pos=\"1,6\" aria-label=\"Phone: steps 1 and 6\">\n          <span class=\"pf__phone\"><span class=\"pf__shell\"><span class=\"pf__screen\">\n            <span class=\"pf__appbar\">My <span>stations<\/span><\/span>\n            <span class=\"pf__body\">\n                              <span class=\"pf__scr is-on\" data-s=\"1\" data-tone=\"orange\">\n                                  <span class=\"pf__fbtn\">Load<span class=\"pf__finger\"><svg class=\"pf__ic\" viewbox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M9 11V5.5a1.6 1.6 0 013.2 0V10l4.2 1a2 2 0 011.5 2v3a4 4 0 01-4 4h-2a4 4 0 01-3.2-1.6L5.5 14a1.4 1.4 0 012.2-1.6L9 14\"\/><\/svg><\/span><\/span>\n                  <span>You tap the button<\/span>                                <\/span>\n                              <span class=\"pf__scr\" data-s=\"2\" data-tone=\"orange\">\n                                  <span class=\"pf__spin\"><\/span>\n                  <span class=\"pf__skel\"><b><\/b><b><\/b><b><\/b><\/span>\n                  <span class=\"pf__pill\">BLoC<\/span>\n                                <\/span>\n                              <span class=\"pf__scr\" data-s=\"3\" data-tone=\"amber\">\n                                  <span class=\"pf__spin\"><\/span>\n                  <span class=\"pf__skel\"><b><\/b><b><\/b><b><\/b><\/span>\n                  <span class=\"pf__pill\">Use case<\/span>\n                                <\/span>\n                              <span class=\"pf__scr\" data-s=\"4\" data-tone=\"teal\">\n                                  <span class=\"pf__spin\"><\/span>\n                  <span class=\"pf__skel\"><b><\/b><b><\/b><b><\/b><\/span>\n                  <span class=\"pf__pill\">Repository<\/span>\n                                <\/span>\n                              <span class=\"pf__scr\" data-s=\"5\" data-tone=\"teal\">\n                                  <span class=\"pf__spin\"><\/span>\n                  <span class=\"pf__skel\"><b><\/b><b><\/b><b><\/b><\/span>\n                  <span class=\"pf__pill\">Datasource<\/span>\n                                <\/span>\n                              <span class=\"pf__scr\" data-s=\"6\" data-tone=\"orange\">\n                                  <span class=\"pf__cards\"><b><\/b><b><\/b><b><\/b><\/span>\n                  <span class=\"pf__ok\">\u2713 Data on screen<\/span>                                <\/span>\n                          <\/span>\n            <span class=\"pf__navbar\"><i><\/i><i><\/i><i><\/i><\/span>\n          <\/span><\/span><\/span>\n        <\/button>\n                  <button type=\"button\" class=\"pf__node\" role=\"tab\" data-n=\"2\" aria-label=\"Step 2: BLoC\">\n            <span class=\"pf__tb\" data-tone=\"orange\"><svg class=\"pf__ic\" viewbox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M4 8h13l-3-3\"\/><path d=\"M20 16H7l3 3\"\/><\/svg><\/span>\n            <small>BLoC<\/small>\n          <\/button>\n                  <button type=\"button\" class=\"pf__node\" role=\"tab\" data-n=\"3\" aria-label=\"Step 3: Caso de uso\">\n            <span class=\"pf__tb\" data-tone=\"amber\"><svg class=\"pf__ic\" viewbox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"3\"\/><path d=\"M8.5 12.2l2.5 2.5 4.5-5.4\"\/><\/svg><\/span>\n            <small>Use case<\/small>\n          <\/button>\n                  <button type=\"button\" class=\"pf__node\" role=\"tab\" data-n=\"4\" aria-label=\"Step 4: Repositorio\">\n            <span class=\"pf__tb\" data-tone=\"teal\"><svg class=\"pf__ic\" viewbox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><ellipse cx=\"12\" cy=\"6\" rx=\"8\" ry=\"3\"\/><path d=\"M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6\"\/><path d=\"M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6\"\/><\/svg><\/span>\n            <small>Repository<\/small>\n          <\/button>\n                  <button type=\"button\" class=\"pf__node\" role=\"tab\" data-n=\"5\" aria-label=\"Step 5: Datasource\">\n            <span class=\"pf__tb\" data-tone=\"teal\"><svg class=\"pf__ic\" viewbox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M7 18a4 4 0 01-.6-7.95A6 6 0 0117.9 9 4.5 4.5 0 0118 18z\"\/><path d=\"M12 11v5m0 0l-2-2m2 2l2-2\"\/><\/svg><\/span>\n            <small>Datasource<\/small>\n          <\/button>\n                <span class=\"pf__pk\" aria-hidden=\"true\"><\/span>\n      <\/div>\n    <\/div>\n    <div class=\"pf__txt\">\n      <div class=\"pf__top\">\n        <span class=\"pf__count\" aria-live=\"polite\"><\/span>\n        <div class=\"pf__ctl\">\n          <button type=\"button\" class=\"pf__btn pf__btn--text\" data-play>Play<\/button>\n          <button type=\"button\" class=\"pf__btn\" data-d=\"-1\" aria-label=\"Previous step\"><svg class=\"pf__ic\" viewbox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M15 5l-7 7 7 7\"\/><\/svg><\/button>\n          <button type=\"button\" class=\"pf__btn\" data-d=\"1\" aria-label=\"Next step\"><svg class=\"pf__ic\" viewbox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M9 5l7 7-7 7\"\/><\/svg><\/button>\n        <\/div>\n      <\/div>\n      <div class=\"pf__stack\">\n                  <div class=\"pf__slide is-on\" data-s=\"1\" data-tone=\"orange\">\n            <div class=\"pf__meta\">\n              <span class=\"pf__tag\">Presentation<\/span>              <span class=\"pf__nm\">Step 1 of 6<\/span>\n            <\/div>\n            <h3 class=\"pf__title\">UI event<\/h3>\n            <p class=\"pf__desc\">The user interacts and the view sends an event to the BLoC.<\/p>          <\/div>\n                  <div class=\"pf__slide\" data-s=\"2\" data-tone=\"orange\">\n            <div class=\"pf__meta\">\n              <span class=\"pf__tag\">Presentation<\/span>              <span class=\"pf__nm\">Step 2 of 6<\/span>\n            <\/div>\n            <h3 class=\"pf__title\">BLoC<\/h3>\n            <p class=\"pf__desc\">It emits a loading state and delegates to the use case. It contains no business logic.<\/p>          <\/div>\n                  <div class=\"pf__slide\" data-s=\"3\" data-tone=\"amber\">\n            <div class=\"pf__meta\">\n              <span class=\"pf__tag\">Domain<\/span>              <span class=\"pf__nm\">Step 3 of 6<\/span>\n            <\/div>\n            <h3 class=\"pf__title\">Use case<\/h3>\n            <p class=\"pf__desc\">It represents a single business action and requests the data from the repository through its contract.<\/p>          <\/div>\n                  <div class=\"pf__slide\" data-s=\"4\" data-tone=\"teal\">\n            <div class=\"pf__meta\">\n              <span class=\"pf__tag\">Data<\/span>              <span class=\"pf__nm\">Step 4 of 6<\/span>\n            <\/div>\n            <h3 class=\"pf__title\">Repository<\/h3>\n            <p class=\"pf__desc\">It applies cache-first: it looks locally and, if there is no data, requests it remotely, saves it and turns it into entities with its mapper.<\/p>          <\/div>\n                  <div class=\"pf__slide\" data-s=\"5\" data-tone=\"teal\">\n            <div class=\"pf__meta\">\n              <span class=\"pf__tag\">Data<\/span>              <span class=\"pf__nm\">Step 5 of 6<\/span>\n            <\/div>\n            <h3 class=\"pf__title\">Datasource<\/h3>\n            <p class=\"pf__desc\">It is the only piece that calls the API or storage. It returns DTOs or DBOs, never entities.<\/p>          <\/div>\n                  <div class=\"pf__slide\" data-s=\"6\" data-tone=\"orange\">\n            <div class=\"pf__meta\">\n              <span class=\"pf__tag\">Presentation<\/span>              <span class=\"pf__nm\">Step 6 of 6<\/span>\n            <\/div>\n            <h3 class=\"pf__title\">Back to the UI<\/h3>\n            <p class=\"pf__desc\">The entity goes up to the BLoC, which emits success or error, and the view repaints according to the new state.<\/p>          <\/div>\n              <\/div>\n    <\/div>\n  <\/div>\n<\/div>\n\n  <\/div>\n<\/section>\n\n<section class=\"section\">\n  <div class=\"container\">\n    \n<div class=\"protheme-section-header reveal\" style=\"text-align:left\">\n  <span class=\"section-label-block mono\">State management<\/span>  <h2 class=\"section-title-block\">\n    BLoC or Cubit,<span class=\"accent\"> depending on the case<\/span>  <\/h2>\n<\/div>\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">BLoC<\/span>\n      <span class=\"badge badge--outline\">Full screens<\/span>    <\/div>\n    <h3 class=\"project-card__title\">When there are several events<\/h3>\n    <p class=\"project-card__desc\">For complete features with several distinct events or events that carry data. Events are named in the past tense, states are nouns and a single handler dispatches each event.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">Sealed classes<\/span><span class=\"badge badge--dot\">Events<\/span><span class=\"badge badge--dot\">States<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><article class=\"project-card animate-on-scroll\">\n    <div class=\"project-card__body\">\n    <div class=\"project-card__meta\">\n      <span class=\"badge badge--orange\">Cubit<\/span>\n      <span class=\"badge badge--outline\">Isolated components<\/span>    <\/div>\n    <h3 class=\"project-card__title\">When a single state change is enough<\/h3>\n    <p class=\"project-card__desc\">For small, independent pieces such as a clock, a calendar, a switch or some tabs. Simple state changes with no need for events: a method emits the new state.<\/p>\n    <div class=\"project-card__footer\">\n      <div class=\"project-card__tech\">\n        <span class=\"badge badge--dot\">Toggle<\/span><span class=\"badge badge--dot\">Tabs<\/span><span class=\"badge badge--dot\">Isolated widgets<\/span>      <\/div>\n      <a href=\"\" class=\"btn btn--primary btn--sm\"><\/a>\n    <\/div>\n  <\/div>\n<\/article><\/div>\n<\/div>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:#999999\">Every asynchronous operation follows the same cycle: <strong>in progress \u2192 success or error<\/strong>. The view decides what to paint with a switch expression on the state, with no if\/else chains.<\/p>\n\n  <\/div>\n<\/section>\n\n<section class=\"section section--surface\">\n  <div class=\"container\">\n    \n<div class=\"protheme-section-header reveal\" style=\"text-align:left\">\n  <span class=\"section-label-block mono\">Best practices<\/span>  <h2 class=\"section-title-block\">\n    Day-to-day<span class=\"accent\"> rules<\/span>  <\/h2>\n<\/div>\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<ul style=\"color:#999999\" class=\"wp-block-list arch-list has-text-color\">\n<li>Immutable entities: fields <code>final<\/code> and <code>copyWith<\/code>, with no logic or serialization.<\/li>\n\n\n\n<li>DTOs and DBOs don't leave the data layer: only entities travel upward.<\/li>\n\n\n\n<li>No API calls outside the datasources.<\/li>\n\n\n\n<li>No business logic in the interface or the BLoC: that's what use cases are for.<\/li>\n\n\n\n<li>Navigation, dialogs and snackbars are triggered from the BLoC, never from a widget.<\/li>\n<\/ul>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<ul style=\"color:#999999\" class=\"wp-block-list arch-list has-text-color\">\n<li>One class per file: one entity, DTO or widget per file.<\/li>\n\n\n\n<li>Before creating a new widget, I reuse or extend an existing one.<\/li>\n\n\n\n<li>Folders in kebab-case, files in snake_case and classes with a type suffix (<code>UserEntity<\/code>, <code>UserRepositoryImpl<\/code>).<\/li>\n\n\n\n<li>Strict static analysis and 120-column formatting from the first commit.<\/li>\n\n\n\n<li>A versioned CHANGELOG updated with every delivery.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n  <\/div>\n<\/section>\n\n<section class=\"section\">\n  <div class=\"container\">\n    \n<div class=\"protheme-section-header reveal\" style=\"text-align:left\">\n  <span class=\"section-label-block mono\">Tech<\/span>  <h2 class=\"section-title-block\">\n    Tools<span class=\"accent\"> for every project<\/span>  <\/h2>\n<\/div>\n\n\n<div class=\"wp-block-group is-layout-flex wp-block-group-is-layout-flex\"><span class=\"badge badge--orange\">Flutter<\/span>\n\n<span class=\"badge badge--orange\">Dart<\/span>\n\n<span class=\"badge badge--orange\">BLoC<\/span>\n\n<span class=\"badge badge--orange\">Cubit<\/span>\n\n<span class=\"badge badge--orange\">Sealed classes<\/span>\n\n<span class=\"badge badge--orange\">GetIt<\/span>\n\n<span class=\"badge badge--orange\">injectable<\/span>\n\n<span class=\"badge badge--orange\">Dio<\/span>\n\n<span class=\"badge badge--orange\">easy_localization<\/span><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-group is-layout-flex wp-block-group-is-layout-flex\"><span class=\"badge badge--outline\">flutter_secure_storage<\/span>\n\n<span class=\"badge badge--outline\">shared_preferences<\/span>\n\n<span class=\"badge badge--outline\">Hive<\/span>\n\n<span class=\"badge badge--outline\">SQLite<\/span>\n\n<span class=\"badge badge--outline\">Firebase Messaging<\/span>\n\n<span class=\"badge badge--outline\">mockito<\/span>\n\n<span class=\"badge badge--outline\">bloc_test<\/span><\/div>\n\n  <\/div>\n<\/section>\n\n<section class=\"section section--surface\">\n  <div class=\"container\">\n    \n<div class=\"protheme-section-header reveal\" style=\"text-align:left\">\n  <span class=\"section-label-block mono\">Shall we talk?<\/span>  <h2 class=\"section-title-block\">\n    Want this architecture<span class=\"accent\"> in your app?<\/span>  <\/h2>\n<\/div>\n\n<div class=\"protheme-cta-group reveal protheme-cta-group--full\">\n      <a href=\"\/en\/contacto\/\" class=\"btn btn--primary\">Get in touch<\/a>\n        <a href=\"\/en\/proyectos\/\" class=\"btn btn--outline\">View projects<\/a>\n  <\/div>\n  <\/div>\n<\/section>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-634","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Clean Architecture en Flutter con BLoC | AppsDeveloper<\/title>\n<meta name=\"description\" content=\"Clean Architecture en Flutter: c\u00f3mo estructuro una app para que escale y sea testeable, con capas core, domain, data y presentaci\u00f3n, y cache-first.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/appsdeveloper.es\/en\/arquitectura\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Clean Architecture en Flutter con BLoC | AppsDeveloper\" \/>\n<meta property=\"og:description\" content=\"Clean Architecture en Flutter: c\u00f3mo estructuro una app para que escale y sea testeable, con capas core, domain, data y presentaci\u00f3n, y cache-first.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/appsdeveloper.es\/en\/arquitectura\/\" \/>\n<meta property=\"og:site_name\" content=\"AppsDeveloper\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-03T23:06:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/appsdeveloper.es\/wp-content\/themes\/protheme\/assets\/og-default.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/appsdeveloper.es\\\/arquitectura\\\/\",\"url\":\"https:\\\/\\\/appsdeveloper.es\\\/arquitectura\\\/\",\"name\":\"Clean Architecture en Flutter con BLoC | AppsDeveloper\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/appsdeveloper.es\\\/#website\"},\"datePublished\":\"2026-10-22T18:17:32+00:00\",\"dateModified\":\"2026-11-03T23:06:24+00:00\",\"description\":\"Clean Architecture en Flutter: c\u00f3mo estructuro una app para que escale y sea testeable, con capas core, domain, data y presentaci\u00f3n, y cache-first.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/appsdeveloper.es\\\/arquitectura\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/appsdeveloper.es\\\/arquitectura\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/appsdeveloper.es\\\/arquitectura\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Inicio\",\"item\":\"https:\\\/\\\/appsdeveloper.es\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Arquitectura\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/appsdeveloper.es\\\/#website\",\"url\":\"https:\\\/\\\/appsdeveloper.es\\\/\",\"name\":\"AppsDeveloper\",\"description\":\"Flutter Senior Developer\",\"publisher\":{\"@id\":\"https:\\\/\\\/appsdeveloper.es\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/appsdeveloper.es\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/appsdeveloper.es\\\/#organization\",\"name\":\"AppsDeveloper\",\"url\":\"https:\\\/\\\/appsdeveloper.es\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/appsdeveloper.es\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/appsdeveloper.es\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/appsdeveloper-logo-1024.png\",\"contentUrl\":\"https:\\\/\\\/appsdeveloper.es\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/appsdeveloper-logo-1024.png\",\"width\":1024,\"height\":1024,\"caption\":\"AppsDeveloper\"},\"image\":{\"@id\":\"https:\\\/\\\/appsdeveloper.es\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Clean Architecture en Flutter con BLoC | AppsDeveloper","description":"Clean Architecture en Flutter: c\u00f3mo estructuro una app para que escale y sea testeable, con capas core, domain, data y presentaci\u00f3n, y cache-first.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/appsdeveloper.es\/en\/arquitectura\/","og_locale":"en_US","og_type":"article","og_title":"Clean Architecture en Flutter con BLoC | AppsDeveloper","og_description":"Clean Architecture en Flutter: c\u00f3mo estructuro una app para que escale y sea testeable, con capas core, domain, data y presentaci\u00f3n, y cache-first.","og_url":"https:\/\/appsdeveloper.es\/en\/arquitectura\/","og_site_name":"AppsDeveloper","article_modified_time":"2026-11-03T23:06:24+00:00","og_image":[{"url":"https:\/\/appsdeveloper.es\/wp-content\/themes\/protheme\/assets\/og-default.jpg","width":1200,"height":630,"type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/appsdeveloper.es\/arquitectura\/","url":"https:\/\/appsdeveloper.es\/arquitectura\/","name":"Clean Architecture en Flutter con BLoC | AppsDeveloper","isPartOf":{"@id":"https:\/\/appsdeveloper.es\/#website"},"datePublished":"2026-10-22T18:17:32+00:00","dateModified":"2026-11-03T23:06:24+00:00","description":"Clean Architecture en Flutter: c\u00f3mo estructuro una app para que escale y sea testeable, con capas core, domain, data y presentaci\u00f3n, y cache-first.","breadcrumb":{"@id":"https:\/\/appsdeveloper.es\/arquitectura\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/appsdeveloper.es\/arquitectura\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/appsdeveloper.es\/arquitectura\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Inicio","item":"https:\/\/appsdeveloper.es\/"},{"@type":"ListItem","position":2,"name":"Arquitectura"}]},{"@type":"WebSite","@id":"https:\/\/appsdeveloper.es\/#website","url":"https:\/\/appsdeveloper.es\/","name":"AppsDeveloper","description":"Flutter Senior Developer","publisher":{"@id":"https:\/\/appsdeveloper.es\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/appsdeveloper.es\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/appsdeveloper.es\/#organization","name":"AppsDeveloper","url":"https:\/\/appsdeveloper.es\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/appsdeveloper.es\/#\/schema\/logo\/image\/","url":"https:\/\/appsdeveloper.es\/wp-content\/uploads\/2026\/11\/appsdeveloper-logo-1024.png","contentUrl":"https:\/\/appsdeveloper.es\/wp-content\/uploads\/2026\/11\/appsdeveloper-logo-1024.png","width":1024,"height":1024,"caption":"AppsDeveloper"},"image":{"@id":"https:\/\/appsdeveloper.es\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/appsdeveloper.es\/en\/wp-json\/wp\/v2\/pages\/634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appsdeveloper.es\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/appsdeveloper.es\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/appsdeveloper.es\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appsdeveloper.es\/en\/wp-json\/wp\/v2\/comments?post=634"}],"version-history":[{"count":19,"href":"https:\/\/appsdeveloper.es\/en\/wp-json\/wp\/v2\/pages\/634\/revisions"}],"predecessor-version":[{"id":990,"href":"https:\/\/appsdeveloper.es\/en\/wp-json\/wp\/v2\/pages\/634\/revisions\/990"}],"wp:attachment":[{"href":"https:\/\/appsdeveloper.es\/en\/wp-json\/wp\/v2\/media?parent=634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}