Flutter and Its Use
What is Flutter?
Flutter is a free and open-source mobile UI framework created by Google and released in May 2017. In a few words, it allows you to create a native mobile application with only one codebase. This means that you can use one programming language and one codebase to create two different apps (for iOS and Android).
Why Flutter?
Many developers around the world choose flutter because on writing one code, it automatically generates the code for many platforms like Android, iOS, and Windows. Flutter also supports Web, but it is still in beta version.
Prerequisites
- Dart language
- Little knowledge of Android and iOS
Widget to use
The only widget that supports Flutter (mobile) on educative right now is Android Widget. So let’s use it.
Editor View
Educative's platform consists of widgets which are discussed briefly in Educative Widgets Hence in order to open an android widget you'd have to type '/android' which will show the Android (Beta) widget.
Supported Frameworks
The Android Widget supports five different platforms
- Java
- Kotlin
- Flutter
- React Native
- Frida
Gradle
Gradle is a build automation tool for multi-language software development. It controls the development process in the tasks of compilation and packaging to testing, deployment, and publishing. Supported languages include Java, C/C++, and JavaScript.
Android Widget gives us three versions of Gradle:-
- Gradle 4.x
- Gradle 7.x
- Gradle 7.x JDK-11
By default we are in our project's root directory. You can add files and folders as required.
For a basic Android project, press the "Add Hello World for Flutter" button at the top.
Emulators
Also there are two supported emulators
- Genymotion
- Cuttlefish
Sample Application
A sample application on Educative will look like this, try it yourself:
package com.example.helloworld; import android.os.Bundle; import io.flutter.app.FlutterActivity; import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GeneratedPluginRegistrant.registerWith(this); } }