suspension_bridge

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

suspension bridge

Suspension Bridge #
This simple but powerful package provides a communication layer that can bridge multiple Flutter projects together.
Suspension Bridge facilitates the following:

Two way data communication
Two way method call handling and method invocations

This project is heavily inspired by the Method Channel API.
Data Passage #
You can save data to a channel.
SuspensionBridge().addChannelData(
'investment',
'authData',
{
"accessToken": "<some token string>",
"refreshToken" "<some token string>"
},
);
copied to clipboard
The same data can then be extracted in another Flutter project.
final authData = SuspensionBridge().getChannelData(
'investment',
'authData',
);
copied to clipboard
Method Call Handling #
Register method call hanlders.
SuspensionBridge().registerMethodCallHandler(
'golden-gate-bridge',
(SuspensionBridgeMethod method) {
print('Received method call: ${method.methodName}');
if (method.methodName == 'print') {
print(method.methodData?.runtimeType);
print(method.methodData);
} else if (method.methodName == 'prettyPrint') {
print('-- Pretty print starts --');
print(method.methodData?.runtimeType);
print(method.methodData);
print('-- Pretty print ends --');
}
},
);
copied to clipboard
Invoke methods from different locations.
SuspensionBridge().invokeMethod(
'golden-gate-bridge',
SuspensionBridgeMethod(
'prettyPrint',
methodData: 'Hello, world! Welcome to Golden Gate Bridge!',
),
);

SuspensionBridge().invokeMethod(
'golden-gate-bridge',
SuspensionBridgeMethod(
'print',
methodData: ['Hello', 'world!'],
),
);
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.