Skip to content

Commit

Permalink
Merge pull request #18 from Prashant4900/enable-null-safety
Browse files Browse the repository at this point in the history
enable null safety
  • Loading branch information
viralvaghela authored Jun 6, 2021
2 parents b3c6b30 + b345e27 commit 7589580
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 145 deletions.
36 changes: 15 additions & 21 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,32 @@ class HomePage extends StatefulWidget {
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage>
with SingleTickerProviderStateMixin {
FlutterInsta flutterInsta =
FlutterInsta(); // create instance of FlutterInsta class
class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin {
FlutterInsta flutterInsta = FlutterInsta(); // create instance of FlutterInsta class
TextEditingController usernameController = TextEditingController();
TextEditingController reelController = TextEditingController();
TabController tabController;
TabController? tabController;

String username, followers = " ", following, bio, website, profileimage;
String? username, followers = " ", following, bio, website, profileimage;
bool pressed = false;
bool downloading = false;

@override
void initState() {
super.initState();
tabController = TabController(vsync: this, initialIndex: 1, length: 2);
InitializeDownloader();
initializeDownloader();
downloadReels();
}

void InitializeDownloader() async {
void initializeDownloader() async {
WidgetsFlutterBinding.ensureInitialized();
await FlutterDownloader.initialize(
debug: true // optional: set false to disable printing logs to console
await FlutterDownloader.initialize(debug: true // optional: set false to disable printing logs to console
);
}

void downloadReels() async {
var s = await flutterInsta
.downloadReels("https://www.instagram.com/p/CDlGkdZgB2y");
var s = await flutterInsta.downloadReels("https://www.instagram.com/p/CDlGkdZgB2y");
print(s);
}

Expand All @@ -74,7 +70,7 @@ class _HomePageState extends State<HomePage>
controller: tabController,
children: [
homePage(), // // home screen for Getting profile details
ReelPage() // reel download Screen
reelPage() // reel download Screen
],
),
);
Expand Down Expand Up @@ -149,8 +145,7 @@ class _HomePageState extends State<HomePage>
padding: EdgeInsets.only(top: 10),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(
"$followers\nFollowers",
Expand Down Expand Up @@ -196,7 +191,7 @@ class _HomePageState extends State<HomePage>
}

//Reel Downloader page
Widget ReelPage() {
Widget reelPage() {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expand All @@ -214,8 +209,7 @@ class _HomePageState extends State<HomePage>
),
downloading
? Center(
child:
CircularProgressIndicator(), //if downloading is true show Progress Indicator
child: CircularProgressIndicator(), //if downloading is true show Progress Indicator
)
: Container()
],
Expand All @@ -225,13 +219,13 @@ class _HomePageState extends State<HomePage>
//Download reel video on button clickl
void download() async {
var myvideourl = await flutterInsta.downloadReels(reelController.text);
final taskId = await FlutterDownloader.enqueue(

await FlutterDownloader.enqueue(
url: '$myvideourl',
savedDir: '/sdcard/Download',
showNotification: true,
// show download progress in status bar (for Android)
openFileFromNotification:
true, // click on notification to open downloaded file (for Android)
openFileFromNotification: true, // click on notification to open downloaded file (for Android)
).whenComplete(() {
setState(() {
downloading = false; // set to false to stop Progress indicator
Expand Down
52 changes: 26 additions & 26 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,56 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.1"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.3"
version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "1.0.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -68,14 +68,14 @@ packages:
name: flutter_downloader
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
version: "1.6.1"
flutter_insta:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.1.4"
version: "1.6.1"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -87,42 +87,42 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
version: "0.13.3"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
version: "4.0.0"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10-nullsafety.1"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.1"
version: "1.8.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
version: "1.11.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -134,56 +134,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.2"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.1"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19-nullsafety.2"
version: "0.3.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.12.13 <2.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0"
23 changes: 4 additions & 19 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,39 @@ description: Demonstrates how to use the flutter_insta plugin.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: "none" # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
flutter_downloader: ^1.5.2

flutter_insta:
# When depending on this package from a real application you should use:
# flutter_insta: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
cupertino_icons: ^1.0.2
flutter_downloader: ^1.6.1

dev_dependencies:
flutter_test:
sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
Expand Down
3 changes: 1 addition & 2 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ void main() {
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'),
(Widget widget) => widget is Text && widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
Expand Down
Loading

0 comments on commit 7589580

Please sign in to comment.