flutter_compatibility 0.1.0 copy "flutter_compatibility: ^0.1.0" to clipboard
flutter_compatibility: ^0.1.0 copied to clipboard

An API version-dependent widget management library

flutter_compatibility #

Pub

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>

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(),
    )
  );
}
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");
  },
)

To update programmatically:

CompatibleScope.containerOf(context).update(Version(1, 2, 0));

Contributing #

Contributions are welcome! I am not familiar with the dart programming language and need your help.

2
likes
140
pub points
24%
popularity

Publisher

unverified uploader

An API version-dependent widget management library

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, version

More

Packages that depend on flutter_compatibility