Last updated:
0 purchases
flutter compatibility
flutter_compatibility #
These are useful if you have widgets that depend on the api version of backend.
Installation #
Add dependency for package on your pubspec.yaml:
dependencies:
version: <latest>
copied to clipboard
Example #
A widget is created only if the version specified in CompatibleScope satisfies the conditions of CompatibleBuilder.
If the version parameter of CompatibleScope is null, CompatibleBuilder will not create the widget.
import 'package:flutter_compatibility/compatibility.dart';
import 'package:version/version.dart';
void main() {
runApp(
CompatibleScope(
version: Version(1, 0, 0),
child: const MyApp(),
)
);
}
copied to clipboard
CompatibleBuilder(
minVersion: Version(2, 0, 0),
maxVersion: Version(3, 0, 0),
includeMin: true,
includeMax: false,
builder: (context) {
return const Text(">=2.0.0, <3.0.0");
},
)
copied to clipboard
To update programmatically:
CompatibleScope.containerOf(context).update(Version(1, 2, 0));
copied to clipboard
Contributing #
Contributions are welcome!
I am not familiar with the dart programming language and need your help.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.