fluent_sdk 0.0.1 copy "fluent_sdk: ^0.0.1" to clipboard
fluent_sdk: ^0.0.1 copied to clipboard

Package that provide a way to modularize features through a service locator.

fluent_sdk #

Package that provide a way to modularize features through a service locator.

Getting Started #

Add dependencies #

fluent_sdk:
    git:
      url: https://github.com/aosorio-avilez/flutter_fluent.git
      ref: fluent_sdk-v0.0.1
      path: packages/fluent_sdk

Create a interface/implementation to access the feature functionalities #

// Interface
abstract class HomeApi {
  Widget getHomePage();
}

// Implementation
class HomeApiImpl extends HomeApi {
  @override
  Widget getHomePage() {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Fluent SDK Demo"),
      ),
      body: const Center(
        child: Text("Hello from Fluent SDK"),
      ),
    );
  }
}

Create module #

class HomeModule extends Module {
  HomeModule({super.testMode = false});

  @override
  void build(Registry registry) {
    // Register home api to access globally to it
    registry.registerApi<HomeApi>((it) => HomeApiImpl());
  }
}

Build module #

Fluent.build([
    HomeModule(),
]);

Use it #

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    // Access to home api and get home page
    final homePage = getApi<HomeApi>().getHomePage();

    return MaterialApp(
      home: Scaffold(
        body: homePage,
      ),
    );
  }
}

Example #

0
likes
0
points
389
downloads

Publisher

unverified uploader

Weekly Downloads

Package that provide a way to modularize features through a service locator.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, get_it

More

Packages that depend on fluent_sdk