git_info 1.1.1 copy "git_info: ^1.1.1" to clipboard
git_info: ^1.1.1 copied to clipboard

Reads information about the local git repository to show in app

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:git_info/git_info.dart';

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

// This will not work unless you create a git repo in the example folder
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('git_info_example'),
        ),
        body: FutureBuilder<GitInformation>(
          future: GitInfo.get(),
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              return Center(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text('Branch: ${snapshot.data!.branch}'),
                    Text('Hash: ${snapshot.data!.hash}'),
                  ],
                ),
              );
            } else {
              return SizedBox.shrink();
            }
          },
        ),
      ),
    );
  }
}
4
likes
150
pub points
76%
popularity

Publisher

verified publisherrexios.dev

Reads information about the local git repository to show in app

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on git_info