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

PlatformAndroid

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

example/lib/main.dart

import 'dart:async';

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

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

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

class _MyAppState extends State<MyApp> {
  late 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))),
              ),
              ElevatedButton(
                onPressed: () {
                  openWithStore();
                },
                child: Text('Open With Store'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
140
pub points
48%
popularity

Publisher

verified publishercelestinolopes.tech

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on store_launcher_nullsafe