flutter_url_shortener 1.0.0 copy "flutter_url_shortener: ^1.0.0" to clipboard
flutter_url_shortener: ^1.0.0 copied to clipboard

outdated

A URL shortener built with Flutter using bitly API service

flutter_url_shortener #

A URL shortener built with Flutter using bitly API service

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Example #

import 'package:flutter/material.dart';
import 'package:flutter_url_shortener/bitly.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String _shortenURL = '';

  void _incrementCounter() {
    FShort.instance.setup(token: '');
    FShort.instance
        .generateShortenURL(url: 'https://www.google.com.vn/')
        .then((value) {
      setState(() {
        _shortenURL = value;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'Full: https://www.google.com.vn',
            ),
            Text(
              'Shorten: $_shortenURL',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Generate',
        child: Icon(Icons.play_arrow),
      ),
    );
  }
}
9
likes
0
pub points
85%
popularity

Publisher

unverified uploader

A URL shortener built with Flutter using bitly API service

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_url_shortener