Last updated:
0 purchases
shareapks
shareapks #
A flutter plugin for share you app to other device through wi-fi or other interface(Heavily inspired from xender)!
Note: This plugin is only work in Android device .
Usage: #
Add dependency: #
Please check the latest version before installation.
If there is any problem with the new version, please use the previous version
dependencies:
flutter:
sdk: flutter
# add shareapks
shareapks: ^{latest version}
copied to clipboard
Add the following imports to your Dart code: #
import 'package:shareapks/shareapk.dart';
copied to clipboard
Widget:
consider using if (io.Platform.isAndroid) because it works only android device
Share()
copied to clipboard
Example :
import 'dart:io' as io;
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:shareapks/shareapk.dart';
void main() => runApp(Material(child: MaterialApp(home: start())));
class start extends StatelessWidget {
const start({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Center(
child: ElevatedButton(
onPressed: () {
Navigator.push(
context, MaterialPageRoute(builder: (context) => shareme()));
},
child: Text("Share"),
)),
),
);
}
}
class shareme extends StatelessWidget {
const shareme({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Share"),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Stack(
children: [if (io.Platform.isAndroid) Share()],
),
),
);
}
}
copied to clipboard
Api
Shareapks.onShared?.listen((event) {
if (event == "Finished")
{
}
else{
}
});
copied to clipboard
Example :
import 'dart:io' as io;
import 'package:android_util/android_ip.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:shareapks/shareapk.dart';
import 'package:shareapks/shareapks.dart';
void main() => runApp(Material(child: MaterialApp(home: start())));
class start extends StatefulWidget {
const start({Key? key}) : super(key: key);
@override
State<start> createState() => _startState();
}
class _startState extends State<start> {
Widget _mywidget = Container();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_mywidget,
Container(
child: Center(
child: ElevatedButton(
onPressed: () {
Shareapks.onShared?.listen((event) {
if (event == "Finished")
setState(() {
_mywidget = Container(child: Text("Finished"));
});
else
setState(() {
_mywidget = CircularProgressIndicator();
});
});
},
child: Text("Send Me"),
)),`
),
],
),
);
}
}
copied to clipboard
Problem And solution
problem 1: After sharing apk file it coud'nt install?
solution :You must build apk by flutter build apk --split-per-abi Because debug file coud'nt install on other device
Reference
Flaticon (Icon)
Xender (Inspired)
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.