katana_functions 1.1.10 copy "katana_functions: ^1.1.10" to clipboard
katana_functions: ^1.1.10 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 Maintained with Melos


[YouTube] | [Packages] | [Twitter] | [LinkedIn]


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.
0
likes
0
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

License

unknown (LICENSE)

Dependencies

flutter, katana

More

Packages that depend on katana_functions