guilherme-v / store_launcher

A Flutter plugin for launching a Store in the mobile platform. Supports AppStore and PlayStore.

Home Page:https://pub.dev/packages/store_launcher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

store_launcher

A Flutter plugin for launching a Store in the mobile platform. Supports AppStore and PlayStore.

Usage

To use this plugin, add store_launcher as a dependency in your pubspec.yaml file.

Example

import 'dart:async';

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

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final myController = TextEditingController();

  @override
  void dispose() {
    myController.dispose();
    super.dispose();
  }

  Future<void> openWithStore() async {
    var appId = myController.text;
    print('app id: $appId');
    try {
      StoreLauncher.openWithStore(appId).catchError((e) {
        print('ERROR> $e');
      });
    } on Exception catch (e) {
      print('$e');
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin store_launcher example app'),
        ),
        body: Container(
          padding: EdgeInsets.all(12.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              TextField(
                controller: myController,
                decoration: InputDecoration(
                    hintText: 'Please enter Package Name',
                    border: OutlineInputBorder(
                        borderSide: BorderSide(color: Colors.teal))),
              ),
              RaisedButton(
                onPressed: () {
                  openWithStore();
                },
                child: Text('Open With Store'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

About

A Flutter plugin for launching a Store in the mobile platform. Supports AppStore and PlayStore.

https://pub.dev/packages/store_launcher

License:MIT License


Languages

Language:Kotlin 29.3%Language:Ruby 27.5%Language:Dart 22.3%Language:Swift 16.5%Language:Objective-C 4.5%