katana_functions 2.6.5 copy "katana_functions: ^2.6.5" to clipboard
katana_functions: ^2.6.5 copied to clipboard

Provides an interface to execute server-side processing in a type-safe manner. Actual processing on the server side is done by importing a separate adapter.

Masamune logo

Katana Functions

Follow on Twitter Follow on Threads Maintained with Melos

GitHub Sponsor


[GitHub] | [YouTube] | [Packages] | [Twitter] | [Threads] | [LinkedIn] | [mathru.net]


Adapter plug-ins for server integration such as Cloud Functions for Firebase.

It is possible to work with @mathrunet/masamune to secure client-side implementations.

Installation #

Import the following packages

flutter pub add katana_functions

If you use Cloud Functions for Firebase, import the following packages as well.

flutter pub add katana_functions_firebase

Implementation #

Advance preparation #

Always place the FunctionsAdapterScope widget near the root of the app.

Pass a FunctionsAdapter such as RuntimeFunctionsAdapter as the parameter of adapter.

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return FunctionsAdapterScope(
      adapter: const RuntimeFunctionsAdapter(),
      child: MaterialApp(
        home: const FunctionsPage(),
        title: "Flutter Demo",
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
      ),
    );
  }
}

Using Functions #

Create a Functions object as shown below and call the corresponding method.

If the corresponding method is not implemented on the server side, an error is returned.

final functions = Functions();
await functions.sendNotification(
  title: "Title",
  text: "Push Notifications",
  target: "TopicName",
);

FunctionsAdapter #

The following FunctionsAdapter is available

  • RuntimeFunctionsAdapter:FunctionsAdapter that completes without server processing and without error. available as a stub.
  • FirebaseFunctionsAdapter:FunctionsAdapter for using FirebaseFunctions, available by defining a Function using @mathrunet/mathamune.

GitHub Sponsors #

Sponsors are always welcome. Thank you for your support!

https://github.com/sponsors/mathrunet

0
likes
140
pub points
5%
popularity

Publisher

verified publishermathru.net

Provides an interface to execute server-side processing in a type-safe manner. Actual processing on the server side is done by importing a separate adapter.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, katana

More

Packages that depend on katana_functions